[Haskell-cafe] |> vs. $ (was: request for code review)

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Mar 9 02:37:34 EST 2006


Hello Shannon,

Thursday, March 9, 2006, 1:19:39 AM, you wrote:

>> I'd use a State-monad, say

SjB> I suspect you guys are right.  I had always thought of states as
SjB> being "isomorphic" to integers (i.e. you can be in state 0, state 1,
SjB> ... state n), not as contexts (you have this input, that output, and
SjB> this token stack), am I wrong?  I suspect I need to spend more time
SjB> trying to understand the state monad.  I must admit that I baulked
SjB> the last time I tried to squeeze it into my head.  I'll just need to
SjB> try again ;)

1) read the "monad tutorial"
2) state is just a value what can be get/set. it's an "emulation" of
global mutable variables present in other languages. because this
state can be a tuple, you can emulate multiple vars. that's all

as i said, in State monad each monadic computation is actually
transition from old variable's contents to their new contents



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list