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

"I've had monads explained to me several times right here on HN"

Well, let's add one to the pile, though I second the "use some monads" recommendation. This is one perspective; there are others:

Monad is an interface. It is used when reifying certain kinds of context to give a standard way of chaining those contexts. That reification means 1) you can talk explicitly about those contexts, and 2) the type system can enforce more rules around those contexts. The abstraction provided by the interface means we can hide away a lot of the plumbing.

The Monad interface is defined in terms of a type constructor; that is, a type-level function that takes a type as an argument and produces another type - like a C++ template with one argument. There is a sense in which the monad "wraps" the "inner" type, though for some monads this is metaphorical at best. Still, it provides a vocabulary.



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

Search: