A collection of useful functions for sorting and comparing characters, strings, and lists.
Author: Michael Hanus
Version: April 2016
sort
:: Ord a => [a] > [a]
The default sorting operation, mergeSort, with standard ordering <= .

sortBy
:: (a > a > Bool) > [a] > [a]
The default sorting operation: mergeSort 
sorted
:: Ord a => [a] > Bool
sorted xs
is satisfied if the elements xs
are in ascending order.

sortedBy
:: (a > a > Bool) > [a] > Bool
sortedBy leq xs
is satisfied if all adjacent elements of the list xs
satisfy the ordering predicate leq .

permSort
:: Ord a => [a] > [a]
Permutation sort with standard ordering <= .

permSortBy
:: Eq a => (a > a > Bool) > [a] > [a]
Permutation sort with ordering as first parameter. 
insertionSort
:: Ord a => [a] > [a]
Insertion sort with standard ordering <= .

insertionSortBy
:: (a > a > Bool) > [a] > [a]
Insertion sort with ordering as first parameter. 
quickSort
:: Ord a => [a] > [a]
Quicksort with standard ordering <= .

quickSortBy
:: (a > a > Bool) > [a] > [a]
Quicksort with ordering as first parameter. 
mergeSort
:: Ord a => [a] > [a]
Bottomup mergesort with standard ordering <= .

mergeSortBy
:: (a > a > Bool) > [a] > [a]
Bottomup mergesort with ordering as first parameter. 
leqList
:: Eq a => (a > a > Bool) > [a] > [a] > Bool
Lessorequal on lists. 
cmpList
:: (a > a > Ordering) > [a] > [a] > Ordering
Comparison of lists. 
leqChar
:: Char > Char > Bool
Lessorequal on characters (deprecated, use Prelude.<= ).

cmpChar
:: Char > Char > Ordering
Comparison of characters (deprecated, use Prelude.compare ).

leqCharIgnoreCase
:: Char > Char > Bool
Lessorequal on characters ignoring case considerations. 
leqString
:: String > String > Bool
Lessorequal on strings (deprecated, use Prelude.<= ).

cmpString
:: String > String > Ordering
Comparison of strings (deprecated, use Prelude.compare ).

leqStringIgnoreCase
:: String > String > Bool
Lessorequal on strings ignoring case considerations. 
leqLexGerman
:: String > String > Bool
Lexicographical ordering on German strings. 
The default sorting operation, mergeSort, with standard ordering

The default sorting operation: mergeSort 


Permutation sort with standard ordering 
Permutation sort with ordering as first parameter. Sorts a list by finding a sorted permutation of the input. This is not a usable way to sort a list but it can be used as a specification of other sorting algorithms. 
Insertion sort with standard ordering

Insertion sort with ordering as first parameter. The list is sorted by repeated sorted insertion of the elements into the already sorted part of the list. 
Quicksort with standard ordering

Quicksort with ordering as first parameter. The classical quicksort algorithm on lists. 
Bottomup mergesort with standard ordering

Bottomup mergesort with ordering as first parameter. 
Lessorequal on lists. 
Comparison of lists. 
Lessorequal on characters (deprecated, use 
Comparison of characters (deprecated, use 
Lessorequal on characters ignoring case considerations. 
Lessorequal on strings (deprecated, use 
Comparison of strings (deprecated, use 
Lessorequal on strings ignoring case considerations. 
Lexicographical ordering on German strings. Thus, upper/lowercase are not distinguished and Umlauts are sorted as vocals. 