[Haskell-cafe] Monad.Reader with updates

Mauricio briqueabraque at yahoo.com
Thu Nov 6 06:30:00 EST 2008


Is there some abstraction in current ghc library
that implements something like Reader, but where
the value of the environment is updated at every
"step"? I imagine something that instead of running
like this:

runReader ( do ... ) environment

I would run like:

runReader ( do ... ) environment update_function

So, when I write a monad like:

      a <- asks f
      b <- asks f2
      c <- asks f3

f, f2 and f3 would be called with parameters
environment, (update_function environment),
(update_function . updatefunction $ environment)

Does that make sense? Is it easy to adapt
something already existing to do that?


More information about the Haskell-Cafe mailing list