[Haskell-cafe] Learn You a Haskell for Great Good - a few doubts
max.rabkin at gmail.com
Fri Mar 4 16:50:30 CET 2011
On Fri, Mar 4, 2011 at 17:37, Chris Smith <cdsmith at gmail.com> wrote:
> The most common use of Ord in real code, to be honest, is to use the value
> in some data structure like Data.Set.Set or Data.Map.Map, which requires Ord
> instances. For this purpose, any Ord instance that is compatible with Eq
> will do fine.
It's true that you can build valid Maps and Sets with any valid
instance of Ord that defines a total order that is consistent with Eq,
and lookup, membership testing and insert will work. However, there
are operations on Maps and Sets which make the order visible to the
caller: min, max, splits, folds, etc.
More information about the Haskell-Cafe