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

The association between IO and monads is just that Haskell uses a monad for IO as a clever hack to support IO in an otherwise pure and lazy language. But this is just one use of monads. Monads in themselves does not have anything in particular to do with IO.

Monads are a pattern for function composition. In most languages it is verbose compared to alternatives (like map and filter), but Haskell have some syntactic sugar which makes it a nice succint way of chaining functions.

The problem with monad tutorials is they try to explain monads as some abstract, universal concept disconnected from practical code. But try to explain functions or classes the same way and it would also be incomprehensible for someone unfamiliar with the concept.

It is not due to ill will, it is just that Hakell-fans tend to have a background in mathematics and therefore default to the most abstract explanation possible, where software developers prefer to start with something practically useful and then generalize from there.

You probably wouldnt understand ‘map’ either, if it was explained to you by a haskelite, since they tend to explain functions in terms of their type signatures rather than what they actually does.

Monads should be exlained through practical code examples in Haskell since this is the context where it makes sense.



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

Search: