<div class="gmail_quote">On Sat, Aug 25, 2012 at 3:25 AM, Erik Hesselink <span dir="ltr"><<a href="mailto:hesselink@gmail.com" target="_blank">hesselink@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'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 -> f (liftM<br>
StMGeoServer . run . unGeoServer)))<br>
restoreM = GeoServer . restoreM . unStMGeoServer<br></blockquote><div><br></div><div>Thank you all, i've adapted Chris'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 <<a href="mailto:yi.codeplayer@gmail.com">yi.codeplayer@gmail.com</a>> wrote:<br>
> I have a `newtype Yun a = Yun { unYun :: ReaderT YunEnv (ResourceT IO) a }`<br>
> , and i need to define an instance of `MonadBaseControl IO` for it.<br>
> Newtype instance deriving don't work here. I guess the answer is simple, i<br>
> just can't figure it out, hope anybody can lightening me.<br>
><br>
> Best regards.<br>
> Yihuang.<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><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>