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:

  1. Left identity: M.chain(M.of(a), f) = f(a)
  2. 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)

Signature

export interface Monad<F> extends Applicative<F>, Chain<F> {}

Added in v2.0.0

Monad1 (interface)

Signature

export interface Monad1<F extends URIS> extends Applicative1<F>, Chain1<F> {}

Added in v2.0.0

Monad2 (interface)

Signature

export interface Monad2<M extends URIS2> extends Applicative2<M>, Chain2<M> {}

Added in v2.0.0

Monad2C (interface)

Signature

export interface Monad2C<M extends URIS2, L> extends Applicative2C<M, L>, Chain2C<M, L> {}

Added in v2.0.0

Monad3 (interface)

Signature

export interface Monad3<M extends URIS3> extends Applicative3<M>, Chain3<M> {}

Added in v2.0.0

Monad4 (interface)

Signature

export interface Monad4<M extends URIS4> extends Applicative4<M>, Chain4<M> {}

Added in v2.0.0