You can write
data Day = Monday | Tuesday | Wednesday | Thursday | Friday deriving Eq
This means that the GHC automatically generates an Eq instance for the day. It will generate (==) so that Monday == Monday , Tuesday == Tuesday True , etc., but Monday == Friday - False
Please note that you cannot write something like
(==) :: Day -> Day -> Bool x == x = True x == y = False
that maybe what you were thinking about.
If you try, the GHC will complain about conflicting definitions for x.
source share