<div dir="ltr">I actually released a library a week or two back that uses this trick:<div><br></div><div><a href="https://github.com/fpco/monad-unlift#reference-transformers">https://github.com/fpco/monad-unlift#reference-transformers</a></div><div><br></div><div>The main advantage in my mind is that the state survives exceptions.<br><br><div class="gmail_quote">On Sat, Apr 18, 2015 at 12:09 PM Konstantin Saveljev <<a href="mailto:konstantin.saveljev@gmail.com">konstantin.saveljev@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I'm working on a project where I use StateT MyState IO a to keep track of the state. MyState is deeply nested and I use lens to help me more easily access and modify the state.</div><div><br></div><div>Just about yesterday I found someone mentioning about using ReaderT (IORef MyState) IO a instead of StateT MyState IO a because we are already in IO. </div><div><br></div><div>Can someone explain to me what are the benefits of these different approaches? What about Garbage Collection in both cases (if there is any difference at all)? Can you use lens package to access and update the state which is hidden behind IORef ?<br><div><br></div><div>Thanks,</div><div>Konstantin Saveljev</div></div></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div></div></div>