
16 Nov
2010
16 Nov
'10
12:10 a.m.
On Mon, Nov 15, 2010 at 9:59 PM, Russ Abbott
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