as I said in my comment, you are breaking the laws Ord
:
a :: State
a = State (Set.fromList ["A"]) (Set.fromList ["B"])
b :: State
b = State (Set.fromList ["B"]) (Set.fromList ["A"])
as of now a == b
, as well as a < b
:
Ξ»> a == b
True
Ξ»> a < b
True
Ξ»> b < a
False
see: there Ord
should be an entire order , and one of them -
a <b if and only if a β€ b and a β b
, , :
instance Ord State where
(State s0 s1) <= (State s0' s1') =
Set.union s0 s1 <= Set.union s0' s1'
Ξ»> a == b
True
Ξ»> b < a
False
Ξ»> a < b
False