[Haskell-cafe] Monad.Reader with updates

2008-11-06 Thread Mauricio

Hi,

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:

do
 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)
etc.

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

Thanks,
MaurĂ­cio

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Monad.Reader with updates

2008-11-06 Thread Bulat Ziganshin
Hello Mauricio,

Thursday, November 6, 2008, 2:30:00 PM, you wrote:

 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?

do-it-yourself? you can start from reader definition and add what you
need. you just need to make initial state consisting from state
itself and update function so `run` will have just one initialization argument

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe