[Haskell-cafe] Why do I have to specify (Monad m) here again?

Marc Weber marco-oweber at gmx.de
Sun Feb 18 12:05:24 EST 2007


On Sun, Feb 18, 2007 at 06:59:32PM +0300, Bulat Ziganshin wrote:
> Hello Marc,
> 
> Sunday, February 18, 2007, 7:32:54 PM, you wrote:
> 
> > When using your example (Monad IO):
> >         class (Monad m) => MonadIO m where
> >                 liftIO :: IO a -> m a
> > it it basically the same, isn't it?  This declaration forces m to be monad..
> > which would't hurt if GHC would infer m beeing a monad automatically?
> 
> it is more explicit. for example, this simplifies understanding of
> error messages generated by compiler. and, if you change 'class'
> declaration, this will not silently change meaning of 'instance' declaration

Is there a difference at all wehter specifying (Monad m) in the class
declaration or not? I have to add it to the instance declaration
anyway..
And if you don't want to change the meaning of instance declaration you
would be able to add this constraint to indicate this.

I don't see why it simplifies error messages.

Marc


More information about the Haskell-Cafe mailing list