Dear all
A student from a beginners course on Functional Programming came to me with a problem, he declared a type like:
data WeekDay = Mon | Tue | Fri -- ...
He had forgot to complete a Show instance definition.
instance Show WeekDay where
(empty)
Then he complained about getting *** Exception: stack overflow
when he tried to invoke some function on that type.
After checking the Haskell98 grammar I found out that this is allowed syntactically and probably semantically too. Is there any reason to do that?
Now I'm wondering: Shouldn't a class be an warranty of a well defined interface? Thus forcing the user to define the show function or showPrec? Am I missing any point?
My best regards,
Hugo