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

David Tolpin david.tolpin at gmail.com
Sun Feb 18 15:42:26 EST 2007

On Mon, 19 Feb 2007 00:30:47 +0400, Sebastian Sylvan <sebastian.sylvan at gmail.com> wrote:
> Well, I guess the H98 report would be a good start. But there are
> multiple tutorials on type classes that will cover this, most of which
> are available from haskell.org


I did read H98 and would like an exact reference.

> The key point is that Haskell won't guess, and in particular it won't
> contradict what you tell it. I think that's the major flaw in your
> reasoning, you expect Haskell to take an explicit type that you, the
> programmer, supplies, and change it into something else.

Why is this rule applied differently to type declarations and to instances?

> In the original example you are explicitly telling Haskell that "m" is
> *not* in the Monad (or any other) class.

I am not telling that. I am telling that m is an instance of a class all instances of which are in the Monad class. How is this different from specifying class constraint in type declarations?


More information about the Haskell-Cafe mailing list