[Haskell-beginners] Re: Apparent bug
Tobias Brandt
tob.brandt at googlemail.com
Tue Nov 16 13:12:12 EST 2010
Hi Russ,
On 16 November 2010 18:52, Russ Abbott <russ.abbott at gmail.com> wrote:
> I think GHCi is wonderful software. But I doubt that anyone would claim that
> it's bug-free. I'm surprised that there is so
> much resistance to acknowledging what appears to be a bug. Why not just fix
> it?
> To review, how should this be interpreted?
>
> data Test = Test
> instance Show Test -- The problem occurs even without "where"
>
>> Test
>
> What interpretation justifies GHCi going into an uninterruptable state at
> this point?
> -- Russ
It's not a bug but it should give a warning. The reason why this
compiles is that
there are default implementations for all members of the Show class.
Unfortunately,
they are defined in terms of them selves (show uses shows uses
showPrec uses show).
You have to define at least one to not get caught in an endless loop.
But there is
no way for GHC to know that.
Regards,
Tobias
More information about the Beginners
mailing list