
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.
*
-- Russ*
***
*
**
On Mon, Nov 15, 2010 at 9:10 PM, Antoine Latter
On Mon, Nov 15, 2010 at 9:59 PM, Russ Abbott
wrote: This looks like a GHCi bug. Load a file with these two lines into GHCi
data Test = Test instance Show Test where -- No body to the instance statement
A Show instance without a body isn't valid. Perhaps you wanted:
data Test = Test deriving Show
If you take a look at the source for the Show class:
http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/src/GHC-Show....
you can see that the function 'show' has a default implmentation of 'show' in terms of 'showsPrec', whicle 'showsPrec' has a default implementation in terms of 'show', so you end up with an infinite loop.
The idea is that you can pick which one to implement - but you do need to pick :-)
Antoine