RE: [Haskell-cafe] Classes in type declarations in Hugs

| 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. Simon

On Mon, Dec 06, 2004 at 10:15:19AM -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.
From my code:
... deriving (MonadIO, MonadReader PGExecEnv, Functor, MonadCont) ... deriving (Monad, MonadWriter PP.Doc, MonadReader PGExecEnv, MonadIO, Functor) Best regards, Tomasz
participants (2)
-
Simon Peyton-Jones
-
Tomasz Zielonka