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

David Tolpin david.tolpin at gmail.com
Sun Feb 18 11:19:14 EST 2007

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

Hello Bulat,

do you mean that the fact that one must keep class and instance declaration in agreement manually is an advantage and not just a limitation of the Haskell type system? Why then not just require that all constraints be declared explicitly. The following code compiles: is it a bad thing that it does?

class (Eq a) => Eql a where
    (=:=) :: a -> a -> Bool
    x =:= y = x == y

eql :: Eql a => a -> a -> Bool
eql x y = x == y


More information about the Haskell-Cafe mailing list