Stack usage with a state monad

Joe Thornber thornber at
Fri Jan 2 17:14:44 EST 2004

On Fri, Jan 02, 2004 at 02:46:04PM +0000, Graham Klyne wrote:
> If your calculation really needs to update the cache state as it goes 
> along, then I agree that it needs to be run in the state monad.  But even 
> then, I'd be inclined to look for sub-calculations that can be evaluated as 
> ordinary functions.

I think I do need to update the cache state, though I do think I could
still split the function into 2 mutually recursive functions (both
returning the state monad) as you suggest, which would at least make
the code clearer.

> Anyway, I think I've probably added enough noise to this debate.  Whatever 
> approach you may use, have fun!

Thanks for your help.

- Joe

More information about the Haskell-Cafe mailing list