4 ms·
I've found these Haskell slides useful: http://dev.stephendiehl.com/hask/ http://dev.stephendiehl.com/hask/ The slides suggest an "Eightfold Path to Monad Sato
by Buttons840 13y ago
I've found these Haskell slides useful: http://dev.stephendiehl.com/hask/ 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.
- JoshTriplett 13y ago> 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.
- ndeine 13y agoBetter yet, isn't that what the State Monad[1] is doing internally? [1]: http://www.haskell.org/haskellwiki/State_Monad http://www.haskell.org/haskellwiki/State_Monad
- rwosync 13y agoLots 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 http://dev.stephendiehl.com/begin/index.html#monads