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

Yitzchak Gale gale at sefer.org
Sun Feb 18 14:05:23 EST 2007


I wrote:
> The other way is if the type is
> not fully specified - it is a variable - then you can
> "pass the buck" and say that whoever uses this
> instance must first make sure that the value of
> the type variable is a type that already has a
> Monad instance.

In this case, you are creating an obligation
on users of this instance - they are required
to provide the Monad instance themselves.

So it makes sense that you need to write the
constraint "Monad m =>" on the instance
declaration, to make sure this obligation is
clear to the users of the instance.

Regards,
Yitz


More information about the Haskell-Cafe mailing list