GHCi> compare 2 3
LT
GHCi> compare 3 3
EQ
GHCi> compare 4 3
GT
I think EQ means equal, but what do LT and GT mean?
compare 2 3 = LT
— 2 is Less Than 3compare 3 3 = EQ
— 3 is EQual to 3compare 4 3 = GT
— 4 is Greater Than 3It's unfortunate that the documentation for Ordering
does not explicitly spell this out.
It's not in haskell only, GT
and LT
are very common and well known acronyms respectively for Greater Than and Less Than. Other common acronyms for comparisons include GE and LE, i.e. Greater or Equal and Less or Equal, but they are not part of the Haskell's Ordering
data constructors. You are right about EQ
= "equal".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With