Wednesday, March 09, 2011
The If Works - Translation from Haskell to JavaScript of selected portions of the best introduction to monads I’ve ever read
The If Works - Translation from Haskell to JavaScript of selected portions of the best introduction to monads I’ve ever read: "First up, a little back story. Monads are more prevalent in Haskell because it only allows pure functions, that is functions that do not have side effects. Pure functions accept input as arguments and emit output as return values, and that’s it. The languages I typically use (Ruby and JavaScript) do not have this constraint, but it often turns out to be a useful discipline to enforce yourself. The typical monad introduction will tell you that monads are all about sneaking side effects into this model so you can do I/O, but that’s just one application. Monads are really about composing functions, as we’ll see."