<div dir="ltr"><font color="#003333"><font size="2"><font face="trebuchet ms,sans-serif">I know the code isn't correct. My point is that the compiler didn't complain when the code was loaded, and the interpreter died when it was executed. That shouldn't happen.<br clear="all">
</font></font></font><div dir="ltr"><font><font face="'trebuchet ms', sans-serif"><i><font color="#003333"><br>-- Russ</font></i></font></font></div><div dir="ltr"><font><i></i></font><font class="Apple-style-span" color="#003333" face="'trebuchet ms', sans-serif"><i><br>
</i></font><div><font><font face="'trebuchet ms', sans-serif"><i><font color="#003333"></font></i></font><br></font></div></div>
<br><br><div class="gmail_quote">On Mon, Nov 15, 2010 at 9:10 PM, Antoine Latter <span dir="ltr"><<a href="mailto:aslatter@gmail.com">aslatter@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, Nov 15, 2010 at 9:59 PM, Russ Abbott <<a href="mailto:russ.abbott@gmail.com">russ.abbott@gmail.com</a>> wrote:<br>
> This looks like a GHCi bug.<br>
> Load a file with these two lines into GHCi<br>
><br>
> data Test = Test<br>
> instance Show Test where -- No body to the instance statement<br>
><br>
<br>
</div>A Show instance without a body isn't valid. Perhaps you wanted:<br>
<br>
> data Test = Test<br>
> deriving Show<br>
<br>
If you take a look at the source for the Show class:<br>
<a href="http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/src/GHC-Show.html#Show" target="_blank">http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/src/GHC-Show.html#Show</a><br>
<br>
you can see that the function 'show' has a default implmentation of<br>
'show' in terms of 'showsPrec', whicle 'showsPrec' has a default<br>
implementation in terms of 'show', so you end up with an infinite<br>
loop.<br>
<br>
The idea is that you can pick which one to implement - but you do need<br>
to pick :-)<br>
<font color="#888888"><br>
Antoine<br>
</font></blockquote></div><br></div>