3 ms·
You are not getting my point. He is saying that something (which is kind of like a container or context for values, but even this is a false analogy) behaves li
by wz1000 12y ago
You are not getting my point. He is saying that something (which is kind of like a container or context for values, but even this is a false analogy) behaves like a monad (lets call the monad M) if and only if functions that take some value (of type a) and return a value (that may be of a different type) within the monad (so that would be M b, where M is another type) obey the monad laws when combined with bind and return.
Monadic functions have the type (a -> M b)
return has the type (a -> M a), so injecting a value into a monad
bind has the type (M a -> (a -> M b) -> M b), or without currying, (M a, (a -> M b)) -> M b, so that given a monadic value (M a) and a monadic function (a -> M b), you get a result of type M b.