You haven't defined the Ord
instance for Strength
correctly. You need to define <=
and not <
.
With only <
defined the function <=
enters into an infinite loop as it is defined in terms of compare
and compare
is defined in terms of <=
. Minimal definition needs to define either compare
or <=
.
Here is the fixed code for Ord
instance
instance Ord Strength where
Strength s1 <= Strength s2 =
s1 <= s2