Overview
The Monad type class combines the operations of the Chain and
Applicative type classes. Therefore, Monad instances represent type
constructors which support sequential composition, and also lifting of
functions of arbitrary arity.
Instances must satisfy the following laws in addition to the Applicative and Chain laws:
- Left identity:
M.chain(M.of(a), f) = f(a) - Right identity:
M.chain(fa, M.of) = fa
Note. Functor’s map can be derived: A.map = (fa, f) => A.chain(fa, a => A.of(f(a)))
Table of contents
- Monad (interface)
- Monad1 (interface)
- Monad2 (interface)
- Monad2C (interface)
- Monad3 (interface)
- Monad3C (interface)
Monad (interface)
Signature
export interface Monad<F> extends Applicative<F>, Chain<F> {}
Added in v1.0.0
Monad1 (interface)
Signature
export interface Monad1<F extends URIS> extends Applicative1<F>, Chain1<F> {}
Monad2 (interface)
Signature
export interface Monad2<M extends URIS2> extends Applicative2<M>, Chain2<M> {}
Monad2C (interface)
Signature
export interface Monad2C<M extends URIS2, L> extends Applicative2C<M, L>, Chain2C<M, L> {}
Monad3 (interface)
Signature
export interface Monad3<M extends URIS3> extends Applicative3<M>, Chain3<M> {}
Monad3C (interface)
Signature
export interface Monad3C<M extends URIS3, U, L> extends Applicative3C<M, U, L>, Chain3C<M, U, L> {}