Agree with the advice about monads. You're going to think monads are weird because the first one you encounter is used to hide a particular detail of how Haskell works in the real world, namely that Haskell can't mutate objects, but that running your program mutates the real world. Ignore this use case, because while interesting, it's a messy implementation detail, not something to model in your own code.<p>Use monads for bailing out of computations early (Maybe/Either) or passing some state along through a computation (State). When you're comfortable with those concepts, look at ST for a generalization of what IO does. That is something you can actually use to simplify your own programs.
Would someone please explain what a monad is and why they're useful, in down-to-Earth, simple language that an engineer can appreciate?<p>I know (and use) basically every other CS concept. Monads, though, I've never bothered looking into, because it seems like everyone who talks about them can't resist the urge to use flowery descriptions of their possibilities, rather than examples of their pragmatism.<p>Also, it's suspicious that pg has never once mentioned monads: <a href="https://www.google.com/search?q=site%3Apaulgraham.com%20%22monad%22" rel="nofollow">https://www.google.com/search?q=site%3Apaulgraham.com%20%22m...</a><p>If they're useful, you'd think one of the best hackers would have said something about it. He spent a good deal of his career talking about closures, types, objects, functions, computing theory, lambda calculus, etc. But no monads.<p>So, are they useful? Would anyone please give examples of their usefulness?<p>EDIT: You know what's worse than hero worship? Not being able to make a reasonable argument which uses someone as an example without being accused of hero worship.
I really wish people would start treating languages as languages. `(m >>= f) >>= g ≡ m >>= (\x -> f x >>= g)` is <i>not</i> easy to understand because the symbols don't have names. I can't read it. How is "m >>= f" pronounced?
Anyone got any solutions for cabal hell? I barely use Haskell because 50%+ of everything I try to install fails and I don’t have a freaking clue how to fix it.
It's humorous that most of the article is <i>not</i> about monads, yet the entire discussion around it is about monads. Seriously, monads are only a small part of Haskell.
<p><pre><code> SET : Group
MAN : Lie Group
TOP : Topological Group
GRP : Objects
</code></pre>
The last line should really be "GRP : Abelian Group"<p>See <a href="http://en.wikipedia.org/wiki/Eckmann-Hilton_argument" rel="nofollow">http://en.wikipedia.org/wiki/Eckmann-Hilton_argument</a>
As someone who has been learning haskell for the past 6~ months this is very valuable. I will be studying this and toying around with the examples quite a bit, thanks for this resource!
Not sure how I feel about this thread.<p>A hundred folks who probably haven't investigated how to effectively teach adults, try to explain monads in the space of 3 tweets (probably not the best medium).<p>And then we wonder why folks steer towards less abstract tools. For every person who visits which gains monad satori, how many have we turned away, never to return?