|
|
|
|
|
by koolala
1033 days ago
|
|
Monads are a concept in types and a specific theory but if you throw the rigid definition away can't they be done anywhere? For example, if I have three RaspberryPi's, isn't there a way I could compose them as monads? That is what I mean - it isn't a fair thing for me to say - but I feel like they would be so much more tangible if we could think about them as literal Things like this. Which is why my original example was composition of Programs instead of composition in a specific Programming Language. |
|
From Wadler's paper "The Essence of Functional Programming":
"2.1 What is a monad?
For our purposes, a monad is a triple (M,unitM,bindM) consisting of a type constructor M and a pair of polymorphic functions.
unitM :: a-> M a
bindM :: M a-> (a-> M b)-> M b
These functions must satisfy three laws, which are discussed in Section 2.10."
So the monad is a functor plus a few operations and laws. It is an algebraic structure, not a type of object or function.