[Haskell-beginners] StateT MyState IO a vs ReaderT (IORef MyState) IO a
Konstantin Saveljev
konstantin.saveljev at gmail.com
Sat Apr 18 09:04:30 UTC 2015
Hello,
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.
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.
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 ?
Thanks,
Konstantin Saveljev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150418/5676fcb6/attachment.html>
More information about the Beginners
mailing list