2 - Copyright (C) 2009 Nick Bowler.
4 - License BSD2: 2-clause BSD license. See LICENSE for full terms.
5 - This is free software: you are free to change and redistribute it.
6 - There is NO WARRANTY, to the extent permitted by law.
10 Poset
(..), Sortable
(..), Ordering(..),
14 import Prelude
hiding (Ord
(..), Ordering(..))
15 import Data
.Poset
.Internal
20 instance Poset a
=> Poset
(Maybe a
) where
21 Just x
<= Just y
= x
<= y
25 instance Poset a
=> Poset
[a
] where
26 compare = (mconcat
.) . zipWith compare
28 -- | Sort a list using the default comparison function.
29 sort :: Sortable a
=> [a
] -> [a
]
32 -- | Apply a function to values before comparing.
33 comparing
:: Poset b
=> (a
-> b
) -> a
-> a
-> Ordering
34 comparing
= on
compare