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

Monads in Haskell is just a way to combine two functions into one when the output of the first function doesn't match the input of the 2nd function.

That's all there is to it.

It is not a way to "box values". Yes you can use it for that if the functions you combine happens to operate on "boxed values" (like Maybe) but that has nothing to do with the fundamental idea of what a monad is.

And yes there are "monad rules" that ensures that combining the functions "makes sense". But people sometimes use monads in Haskell that doesn't actually follow those rules. But it works fine anyways for whatever they are doing.



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

Search: