
2 Mar
2011
2 Mar
'11
4:29 a.m.
On 2 March 2011 09:11, Yves Parès
class (forall x. Monad (IM i x)) => Impl i where data IM i :: * -> * -> *
But GHC forbids me to do so.
The way I usually work around this is by doing something like the following pattern: {{{ class Monad1 m where return1 :: a -> m x a bind1 :: m x a -> (a -> m x b) -> m x b instance Monad1 (IM MyI) where return1 = ... bind1 = ... instance Monad1 m => Monad (m x) where return = return1 (>>=) = bind1 }}} Your class can now have a (Monad1 (IM i)) superclass context. You will have to enable a few extensions to get this through - most likely FlexibleInstances and OverlappingInstances. Cheers, Max