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

2007-06-30 Thread Ken Takusagawa
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

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

2007-06-30 Thread Twan van Laarhoven
Ken Takusagawa wrote: 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 f

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

2007-06-30 Thread Benja Fallenstein
Hi Ken, 2007/7/1, Ken Takusagawa <[EMAIL PROTECTED]>: 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. I would suggest declaring a MonadReader instance for State, and writin