[Haskell-cafe] Classes in type declarations in Hugs

Simon Peyton-Jones simonpj at microsoft.com
Tue Dec 7 09:21:55 EST 2004


http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.
html#NEWTYPE-DERIVING

| -----Original Message-----
| From: Graham Klyne [mailto:GK at ninebynine.org]
| Sent: 07 December 2004 10:46
| To: Simon Peyton-Jones; haskell-cafe at haskell.org
| Subject: RE: [Haskell-cafe] Classes in type declarations in Hugs
| 
| At 10:15 06/12/04 +0000, Simon Peyton-Jones wrote:
| >| This is where I find ghc's newtype deriving to be incredibly
useful.
| >|
| >| newtype CPError a = CPError (Either Error a)
| >|         deriving(Monad,MonadError)
| >|
| >| now CPError is a monad and an instance of MonadError and you are
free
| >to
| >| override or inherit more interesting instances at will without
| >| conflicting with the basic types for Either :)
| >
| >Aha!  I've always wondered whether anyone uses this feature, which I
| >implemented at John Hughes's suggestion.  I'd be interested to know
if
| >you are alone, or whether others do so too.
| 
| Not a user, but sounds maybe interesting.  Can you point to
documentation?
| 
| #g
| 
| 
| ------------
| Graham Klyne
| For email:
| http://www.ninebynine.org/#Contact



More information about the Haskell-Cafe mailing list