[Haskell-cafe] Stacking monads - beginner design question

Brent Yorgey byorgey at gmail.com
Wed Jan 30 10:25:04 EST 2008


On Jan 30, 2008 12:44 AM, Adam Smyczek <adam.smyczek at gmail.com> wrote:

> Hi,
>
> My application has to manage a data set. I assume the state monad is
> designed for this.
> The state changes in functions that:
> a. perform IO actions and
> b. return execution status and execution trace (right now I'm using
> WriteT for this).
>
> Is the best solution:
> 1. to build a monad stack (for example State -> Writer -> IO) or
> 2. to use IORef for the data set or
> 3. something else?
>
> Are monad stacks with 3 and more monads common?
> How could an example implementation look like?
>

Hi Adam,

Indeed, this is quite common.  You may be interested in reading

  http://cale.yi.org/index.php/How_To_Use_Monad_Transformers

Good luck!
-Brent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080130/bc18b040/attachment.htm


More information about the Haskell-Cafe mailing list