Hacker News new | past | comments | ask | show | jobs | submit login

Troll answer: but then where would people go if they want to show off their ability to talk in jargon like "applicatives", "arrow", "lenses"?

Serious answer: Not really. Monads are more abstract than just contexts. Monads are commonly used to represent context and contextual computation, but they can represent other things too.




And that goes to show that I haven't really understood them. I won't ask for an explanation because most probably I won't understand them anyways :)


I'd argue that there's no way to understand monads as a whole except by understanding the monadic laws. That is to say, I don't think there's some grand theory that unifies all monadic types. Rather, I think that certain types just happen to be monadic and, as a result, we can reason about and do certain things with those types that we can't do with other types.

What's the similarity between List, State, and IO? I'd argue that there is little similarity apart from the fact that we can define the monadic operations for all three. And, having defined those operations, we can then use more complex operations like `sequence`.

Monadic types sometimes represent data structures, sometimes represent contexts or, in the case of IO, sometimes represent nothing really at all. IO is arguably just a marker that imposes a linear sequence on what would otherwise be unsequenced computation.

In short: don't spend too much time trying to understand monads as a whole. Rather, try to understand why specific types, like List and State, happen to be monadic.




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

Search: