I found the concept of state monads in Haskell quite hard to grasp for a long time, so I thought I'd give a (hopefully) brief description of what they are, why they're useful, and how they work. In addition to being useful and interesting by themselves, understanding state monads will make it much easier to understand the IO monad, which is how
(
Read more... )
Comments 2
Presumably, though, to explicitly thread the state you'd have to pass an updated FooState back out of your method? That is, your type signature would look something like:
Foo:: FooState -> Int -> Int -> (Int, FooState)
Reply
Reply
Leave a comment