[Haskell-beginners] GHCi bug?

Antoine Latter aslatter at gmail.com
Tue Nov 16 00:10:18 EST 2010

On Mon, Nov 15, 2010 at 9:59 PM, Russ Abbott <russ.abbott at gmail.com> 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:

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

The idea is that you can pick which one to implement - but you do need
to pick :-)


More information about the Beginners mailing list