[Haskell-cafe] What puts False before True?

Stefan Holdermans stefan at cs.uu.nl
Fri Jun 1 00:27:54 EDT 2007


> If I'm reading the reports correctly, the Ord instance was
> actually added in the Haskell 1.1 standard, by changing the
> definition of Bool from
> data Bool = True | False
> to
> data Bool = True | False deriving (Eq, Ord, Ix, Enum, Text, Binary)


   data Bool = False | True

> It seems like we actually get that order because deriving Ord makes
> constructors earlier in the definition compare greater than later
> constructors, and nobody was bothered by that ordering.

It's the other way around:

   data T = Less | More deriving (Eq, Ord)

gives you

   *Main> Less < More



More information about the Haskell-Cafe mailing list