import Prelude
data Line = Front | Middle | Back
derive instance eqLine :: Eq Line
instance ordLine :: Ord Line where
compare a b | a == b = EQ
compare Front _ = LT
compare Back _ = GT
compare = flip compare
Why does this give me the error 'Argument list lengths differ in declaration compare'. But if I change the last line to
compare a b = flip compare a b
then it compiles.
I thought flip compare returns a function of 2 args hence matches signature of compare, but apparently it doesn't.
Repl:
> :type flip compare
forall (t4 :: Type). Ord t4 => t4 -> t4 -> Ordering