<div class="gmail_quote">On Sat, Aug 25, 2012 at 3:25 AM, Erik Hesselink <span dir="ltr">&lt;<a href="mailto:hesselink@gmail.com" target="_blank">hesselink@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I&#39;m not sure if you already have something working, but we have<br>
several in our codebase, all following a similar pattern. For example:<br>
<br>
newtype GeoServer a = GeoServer { unGeoServer :: ReaderT<br>
GeoServerState (ServerPartT IO) a }<br>
<br>
instance MonadBaseControl IO GeoServer where<br>
  newtype StM GeoServer a = StMGeoServer { unStMGeoServer :: StM<br>
(ReaderT GeoServerState (ServerPartT IO)) a }<br>
  liftBaseWith f = GeoServer (liftBaseWith (\run -&gt; f (liftM<br>
StMGeoServer . run . unGeoServer)))<br>
  restoreM = GeoServer . restoreM . unStMGeoServer<br></blockquote><div><br></div><div>Thank you all, i&#39;ve adapted Chris&#39;s code which is similar to yours, and it works now. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<span class="HOEnZb"><font color="#888888"><br>
Erik<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Wed, Aug 22, 2012 at 9:16 AM, yi huang &lt;<a href="mailto:yi.codeplayer@gmail.com">yi.codeplayer@gmail.com</a>&gt; wrote:<br>
&gt; I have a `newtype Yun a = Yun { unYun :: ReaderT YunEnv (ResourceT IO) a }`<br>
&gt; , and i need to define an instance of `MonadBaseControl IO` for it.<br>
&gt; Newtype instance deriving don&#39;t work here. I guess the answer is simple, i<br>
&gt; just can&#39;t figure it out, hope anybody can lightening me.<br>
&gt;<br>
&gt; Best regards.<br>
&gt; Yihuang.<br>
&gt;<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><a href="http://yi-programmer.com/" target="_blank">http://yi-programmer.com/</a><br>