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

Marc Weber marco-oweber at gmx.de
Sun Feb 18 13:09:15 EST 2007


David: Thanks again for your explanation
 
> Because, in general, m isn't an instance of Monad. 

Talking about my example:

	class (Monad m) => GetMV m a where
	...
	instance GetMV m c where (2)

(2) There are only 2 cases:
ghc supposes m does instantiates Monad
  => success
ghc doesn't suppose this
  => failure becuase the class head of GetMV does require it.
     fix: adding (Monad m) => (3)

That's why it would be save to assume that the programmer doesn't want a
failure but success.
Thus ghc could infer (3) automatically but doesn't

Do I still miss a point?

Marc


More information about the Haskell-Cafe mailing list