Dear all<br><br>A student from a beginners course on Functional Programming came to me with a problem, he declared a type like:
<br><br><span style="font-weight: bold;">data WeekDay = Mon | Tue | Fri -- ...</span><br><br>He had forgot to complete a Show instance definition.
<br><br><span style="font-weight: bold;">instance Show WeekDay where</span><br><span style="font-weight: bold;">(empty)</span><br><br>Then he complained about getting&nbsp; <span style="font-weight: bold;">*** Exception: stack overflow
</span> when he tried to invoke some function on that type.
<br><br>After checking the Haskell98 grammar I found out that this is allowed syntactically and probably semantically too. Is there any reason to do that? <br><br>Now I&#39;m wondering: Shouldn&#39;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?
<br><span style="font-weight: bold;"></span><span style="font-weight: bold;"><span style="font-weight: bold;"></span></span><br>My best regards,<br><span class="sg">Hugo<br><br>
</span>