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

Dean Herington heringtonlacey at mindspring.com
Sun Feb 18 16:36:52 EST 2007

At 12:42 AM +0400 2/19/07, David Tolpin wrote:
>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.

See section 4.3.2, the third bullet item in the bulleted list.  (Note 
that the last sentence of that bullet item says that context 
inference--though often possible--is deliberately eschewed.)

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