Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've found these Haskell slides useful: http://dev.stephendiehl.com/hask/

The slides suggest an "Eightfold Path to Monad Satori":

1) Don't read the monad tutorials. 2) No really, don't read the monad tutorials. 3) Learn about Haskell types. 4) Learn what a typeclass is. 5) Read the Typeclassopedia. 6) Read the monad definitions. 7) Use monads in real code. 8) Don't write monad-analogy tutorials.

I've found this advice helpful. Monads are something you'd probably invent yourself once you know the rest of the language well enough.




Lots of great Haskell material on his site. In particular this derivation of the State monad from first principles was the "Aha!" moment for me understanding monads.

http://dev.stephendiehl.com/begin/index.html#monads


> Monads are something you'd probably invent yourself once you know the rest of the language well enough.

Very true. I understood monads far better after I wrote some explicitly state-threaded code (where every function took a state and returned (state, actual_return)), wrote functions equivalent to >>= and return, and then turned the result into a monad.


Better yet, isn't that what the State Monad[1] is doing internally?

[1]: http://www.haskell.org/haskellwiki/State_Monad




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: