[Haskell-cafe] Why do I have to specify (Monad m) here again?
Sebastian Sylvan
sebastian.sylvan at gmail.com
Sun Feb 18 08:40:06 EST 2007
On 2/18/07, Marc Weber <marco-oweber at gmx.de> wrote:
> Why do I have to specify (Monad m) here again?
>
> class (Monad m) => GetMV m a where
> ...
>
> instance GetMV m c where
> ...
>
> No instance for (Monad m)
> arising from the superclasses of an instance declaration
> possible fix:
> add (Monad m) to the instance declaration superclass context
>
The class just says that any instance *requires* an instance in Monad.
Nothing more.
So when you try to instantiate something in the class you have to
ensure that it has an instance in Monad. A type variable "m" has no
instance in the class "Monad" unless you constrain it to do so in the
instance declaration (by doing "Monad m =>").
--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
More information about the Haskell-Cafe
mailing list