[Haskell] deriving with newtypes

Wolfgang Jeltsch wolfgang at jeltsch.net
Tue Mar 23 14:54:38 EST 2004


Am Dienstag, 23. März 2004 12:31 schrieben Sie:
> Op zo 21-03-2004, om 18:54 schreef Wolfgang Jeltsch:
> > Hello,
> >
> > I'm trying to use GHC's deriving mechanism for newtypes in the following
> > way: class C a b
> >     instance C [a] Char
> >     newtype T = T Char deriving C [a]
> > Unfortunately, this isn't possible. Is there a reason for this? Can I
> > circumvent this restriction?
>
> You can use the deriving mechanism for user-defined class such as the
> class C above.
> (see http://www.haskell.org/onlinereport/decls.html#derived-decls)

Since you refer to The Haskell Report, I think that you wanted to say: "You 
can *not* use the deriving mechanism..."  But you *can* use it if you use 
-fglasgow-exts.  I was refering to GHC's extension concerning deriving and 
newtypes.

> [...]

> Instead of the deriving construct, you could use the tool
> DrIFT (http://repetae.net/john/computer/haskell/DrIFT/)

I don't want to have a tool involved.

> [...]

> Greetings Arjan

Wolfgang



More information about the Haskell mailing list