John Bevan
@johnlbevan
10 years ago
A Wrapper TypeWrapper Types
A monad is a wrapper which can extend the functionality available to a value or values of a given type, whilst allowing the functionality already available to that type to be accessible through the wrapper and work in the originally designed way. This means that wrapping value v of type t in a monad m, then applying a function f defined in t to this monad should give the same result as applying the same function to v and then wrapping the result in a monad; i.e. m(v).f() === m(v.f()) The result of a call to a monad function for a given value will be a monad of the same type as that on which the function was called, containing the given value with the called function applied. This allows calls to functions to be easily chained. In addition to containing values and added functionality, monads may contain additional information, allowing context to be passed around along with a given value. Monads are often compared as the functional equivalent to OO's Generics; the key difference being that the return type has to be a monad of the same definition/type (but potentially different value) as the monad on which the function was called.

undefinedurl nextprice drop