Haskell state monads, part 1

Jan 21, 2008 22:35


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... )

Leave a comment

Comments 2

Threading the state matt_russell January 22 2008, 18:27:51 UTC
Cool, I look forward to part 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

Re: Threading the state mvanier January 23 2008, 01:33:05 UTC
Yeah, you're right. I'll update the post accordingly. Thanks for pointing it out.

Reply


Leave a comment

Up