<div dir="ltr">&gt; remLookupFwd :: (ReVars m t) =&gt; SimplRe t -&gt; ReM m t (ReInfo t)<br>
&gt; remLookupFwd re<br>
&gt;   = do fwd &lt;- gets resFwdMap<br>
&gt; --       let { Just reinfo = M.lookup fwd re }                    -- PROBLEM<br>
&gt;        reinfo &lt;- liftMaybe $ M.lookup re fwd                      -- PROBLEM<br>
&gt;        return reinfo<br>
&gt;<br>
&gt; liftMaybe :: Monad m =&gt; Maybe a -&gt; m a<br>
&gt; liftMaybe Nothing = fail &quot;Nothing&quot;<br>
&gt; liftMaybe (Just x) = return x<br>
<br>I made two changes:<br>
<br>
1. You had the arguments to M.lookup backwards.<br>
2. lookup does not return any generalized Monad, just Maybe (I think that should be changed). I added the simple liftMaybe function to convert the Maybe result into something that will work with your state monad.<br><br>
Michael<br></div>