The
Down type allows you to reverse sort order conveniently. A
value of type
Down a contains a value of type
a (represented as
Down a). If
a has
an
Ord instance associated with it then comparing two
values thus wrapped will give you the opposite of their normal sort
order. This is particularly useful when sorting in generalised list
comprehensions, as in:
then sortWith by Down x