[Haskell-cafe] Adding state to a library

Kevin Jardine kevinjardine at gmail.com
Sun Dec 18 22:20:13 CET 2011


I have a library of functions that all take cfg parameter (and usually
others) and return results in the IO monad.

It is sometimes useful to drop the config parameter by using a state-like
monad..

I have found that I can wrap all my functions like so:

withLibrary cfg f = f cfg

stateF a b c d =
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111218/8e64dfa4/attachment.htm>


More information about the Haskell-Cafe mailing list