Options
All
  • Public
  • Public/Protected
  • All
Menu

The Monad type class.

Allows composition of dependent effectful functions.

This type-class must support the Applicative, Chain and ChainRec algebras and obey the following laws:

  1. Left identity: M.chain(f, M.of(a)) <-> f(a)
  2. Right identity: M.chain(M.of, u) <-> u
  3. Functor's map can be derived: A.map = (f, u) => A.chain(x => A.of(f(x)), u)

References:

Equivalent with the Monad type-class in the static-land specification.

Type parameters

  • F

Hierarchy

Index

Methods

Methods

ap

  • ap<A, B>(ff: HK<F, function>, fa: HK<F, A>): HK<F, B>

chain

  • chain<A, B>(f: function, fa: HK<F, A>): HK<F, B>
  • Type parameters

    • A

    • B

    Parameters

    • f: function
        • (a: A): HK<F, B>
        • Parameters

          • a: A

          Returns HK<F, B>

    • fa: HK<F, A>

    Returns HK<F, B>

chainRec

  • chainRec<A, B>(f: function, a: A): HK<F, B>
  • Type parameters

    • A

    • B

    Parameters

    • f: function
        • <C>(next: function, done: function, a: A): HK<F, C>
        • Type parameters

          • C

          Parameters

          • next: function
              • (a: A): C
              • Parameters

                • a: A

                Returns C

          • done: function
              • (b: B): C
              • Parameters

                • b: B

                Returns C

          • a: A

          Returns HK<F, C>

    • a: A

    Returns HK<F, B>

map

  • map<A, B>(f: function, fa: HK<F, A>): HK<F, B>

of

  • of<A>(a: A): HK<F, A>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc