2 ms·
> 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 wr
by 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