[Haskell-beginners] Re: Apparent bug

Ozgur Akgun ozgurakgun at gmail.com
Tue Nov 16 13:52:42 EST 2010


On 16 November 2010 18:40, Russ Abbott <russ.abbott at gmail.com> wrote:

> why isn't
>
> instance Show Test
>
> interpreted to mean
>
> data Test = Test deriving (Show)
>
> *
> -- Russ *
>

One of them is declaring an instance, the other is asking the compiler
derive an instance declaration for you. I don't know why the empty one is
interpreted to be an instance deriving. Maybe because in such a case there
would be no way to declare an empty instance?

In addition, there is yet another similar syntax. See stand-alone
deriving<http://haskell.org/ghc/docs/6.12.2/html/users_guide/deriving.html>
.

Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20101116/6f2d803c/attachment.html


More information about the Beginners mailing list