package base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Indexed monad, in the style of Atkey. The second and third parameters are composed across all computation. To see this more clearly, you can look at the type of bind:

val bind : ('a, 'i, 'j) t -> f:('a -> ('b, 'j, 'k) t) -> ('b, 'i, 'k) t

and isolate some of the type variables to see their individual behaviors:

val bind : 'a             -> f:('a ->  'b           ) ->  'b
val bind :      'i, 'j    ->               'j, 'k     ->     'i, 'k

For more information on Atkey-style indexed monads, see:

        Parameterised Notions of Computation
        Robert Atkey
        http://bentnib.org/paramnotions-jfp.pdf
type ('a, 'i, 'j) t
val bind : ('a, 'i, 'j) t -> f:('a -> ('b, 'j, 'k) t) -> ('b, 'i, 'k) t
val map : [ `Define_using_bind | `Custom of ('a, 'i, 'j) t -> f:('a -> 'b) -> ('b, 'i, 'j) t ]
val return : 'a -> ('a, 'i, 'i) t