Yet Another Monad Tutorial (part 7: state monads)

Aug 27, 2010 19:57


In this article we'll look at a very interesting class of monads: state monads.

Read more )

Leave a comment

Comments 6

Excellent Series on Monads. anonymous November 25 2010, 18:12:47 UTC
Your articles on Haskell are the most understandable (and well-written) I have read.

I have the book "Real World Haskell", but am learning far more from you just by concentrating on your articles on Monads.

Thank you, and please keep blogging.

Reply

Re: Excellent Series on Monads. mvanier November 26 2010, 10:53:28 UTC
Thanks for the compliment! I'm glad you're getting something out of the tutorials. I plan to start up again in the new year, so stay tuned.

Reply


typo: return type of runState ext_697914 July 5 2011, 04:27:05 UTC
Hi Mike,

Under the section where runState, evalState and execState functions are shown, there is a typo in "runState returns the final (state, value) tuple". It returns the final (value, state) tuple.

Anyway, thank you for writing this series of tutorials! I've read up to this one and it's probably the clearest tutorials on monads I've read. I think the first tutorial in this series is a classic, especially the way you explain what a monad is.

Reply

Re: typo: return type of runState mvanier July 5 2011, 19:52:41 UTC
Thanks for the bug report! I've fixed it. And thanks for the comments -- tell your friends :-)

Reply


grkuntzmd October 3 2012, 11:14:53 UTC
I started teaching myself Haskell several months ago and have read both "Learn You a Haskell" and "Real-World Haskell", as well as several online tutorials, particularly on monads. I understood monads on an academic level, but could not "internalize" them. That is, until I read your tutorial series, especially the segment on the state monad. Yours is the clearest explanation of this difficult subject that I have seen to date.

Perhaps your might consider collecting your series into a single document and either self-publishing a booklet on Amazon, or at least producing a PDF for people to download. I know that I would add it to my reference library and refer others to read it.

Thanks for explaining this complex subject very clearly.

-Ralph

Reply

mvanier October 3 2012, 18:50:36 UTC
Ralph,

Thanks very much for your kind words! I'll consider publishing this at some point, but I still have stuff to add e.g. on monad transformers.

Mike

Reply


Leave a comment

Up