The expressiveness of Haskell – Sorting.

What first excited me about Haskell was the expressiveness of the language. It somehow encapsulates thought and the problem being solved can often be seen clearly in the solution. Take, for example, sorting a list containing elements of a general type ‘a’. For these to be placed in order it must be possible to compare them. So in Haskell the sort function can be defined as:

i.e. the sort function takes a list of ‘a’ and returns a list of ‘a’ and the restriction on the type of ‘a’ is that it must be an instance of the Ord Read More

ˆ Back To Top