[Haskell-cafe] "Read-only" functions in State Monad

Ken Takusagawa ken.takusagawa.2 at gmail.com
Sat Jun 30 18:25:37 EDT 2007


I'd like to have a state monad with the feature that I can somehow
annotate using the type system that some functions are only going to
read the state and not modify it.  Such read-only functions are only
permitted to call other read-only functions, whereas state-modifying
functions can call both read-only and other state-modifying functions.

How can I do this?  It does not seem to be straightforwardly doable
with Control.Monad.State.

--ken


More information about the Haskell-Cafe mailing list