On 2 March 2011 09:11, Yves Parès <limestr...@gmail.com> wrote: > 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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe