
14 Jun
2011
14 Jun
'11
8:07 a.m.
Hi guys, What I understanding `deriving` is Haskell automatically make a type to be a instance of a particular typeclass. If that's the case, the question is How does Haskell do that underline? Take code below as sample, the type Day is now an instance of Bounded. data Day = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday deriving (Bounded, Enum) Therefore, *minBound :: Day* will produce *Monday*. Just be curious how it is being implemented. Thanks. Simon