As long as Bool not Int , it can be converted to 0,1 fragment Int , since it is an Enum type.
fromEnum False = 0 fromEnum True = 1
Now Enum could be different, changing 0 and 1 , but this is probably surprising for most programmers who think about bits.
Since it has an Enum type, all other things being equal, it is best to define an Ord instance that follows the same order that satisfies
compare xy = compare (fromEnum x) (fromEnum y)
In fact, each instance generated from deriving (Eq, Ord, Enum) follows this property.
In a more theoretical note, logicians seek to order sentences from the strongest to the weakest (forming a lattice). In this structure, False (as a sentence) is the bottom, that is, the smallest element, and True is the top. Although this is only a convention (the theory would be just as good if we chose the opposite order), it’s good to be consistent.
A minor flaw: the logical connection implication is actually p <= q , expressing that p implies q instead of the opposite, as indicated by the arrow.
source share