Thank you !<br><br>Is what I&#39;m trying to do a common technique to type-ensure contexts or are there simpler methods?<br><br><br><div class="gmail_quote">2011/3/2 Max Bolingbroke <span dir="ltr">&lt;<a href="mailto:batterseapower@hotmail.com">batterseapower@hotmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On 2 March 2011 09:11, Yves Parès &lt;<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</a>&gt; wrote:<br>


&gt; class (forall x. Monad (IM i x)) =&gt; Impl i where<br>
&gt;     data IM i :: * -&gt; * -&gt; *<br>
&gt;<br>
&gt; But GHC forbids me to do so.<br>
<br>
</div>The way I usually work around this is by doing something like the<br>
following pattern:<br>
<br>
{{{<br>
class Monad1 m where<br>
    return1 :: a -&gt; m x a<br>
    bind1 :: m x a -&gt; (a -&gt; m x b) -&gt; m x b<br>
<br>
instance Monad1 (IM MyI) where<br>
    return1 = ...<br>
    bind1 = ...<br>
<br>
instance Monad1 m =&gt; Monad (m x) where<br>
    return = return1<br>
    (&gt;&gt;=) = bind1<br>
}}}<br>
<br>
Your class can now have a (Monad1 (IM i)) superclass context. You will<br>
have to enable a few extensions to get this through - most likely<br>
FlexibleInstances and OverlappingInstances.<br>
<br>
Cheers,<br>
<font color="#888888">Max<br>
</font></blockquote></div><br>