[Haskell] Empty instance declaration

Hugo Macedo hmacedo at di.uminho.pt
Thu Dec 27 11:34:06 EST 2007

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

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,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell/attachments/20071227/b8ba9b76/attachment.htm

More information about the Haskell mailing list