package rea

  1. Overview
  2. Docs

Constant functor, products, and applicatives.

type 'c r

Abstract effect representation for Constant.

val to_rea : 'c -> ('c r, 'e, 'a) s

Constant injection.

val of_rea : ('c r, 'e, 'a) s -> 'c

Constant projection.

val from : 'c -> ('c r, 'e, 'a, 'D) er

from value has no effect aside from encapsulating the given value.

Constant functor
class ['c, 'D] functr : object ... end

Base constant functor interpreter dictionary.

val functr : ('c, 'D) functr as 'D

Default functr dictionary.

Constant applicatives
val conjunction : (bool r, 'D) applicative' as 'D

Combines booleans with && lazily.

val disjunction : (bool r, 'D) applicative' as 'D

Combines booleans with || lazily.

val option : ('c option r, 'D) applicative' as 'D

Combines options to return the leftmost some lazily.

val unit_er : (('R, 'e, unit, ['R, 'D] monad' as 'D) er r, 'S) applicative' as 'S

Combines unit effects with bind.

val conjunction_er : (('R, 'e, bool, ['R, 'D] monad' as 'D) er r, 'S) applicative' as 'S

Combines boolean effects with &&& lazily.

val disjunction_er : (('R, 'e, bool, ['R, 'D] monad' as 'D) er r, 'S) applicative' as 'S

Combines boolean effects with ||| lazily.

val option_er : (('R, 'e, 'c option, ['R, 'D] monad' as 'D) er r, 'S) applicative' as 'S

Combines option effects to return the leftmost some lazily.

User defined
val map : 'D -> ('c r, 'e, 'a, 'b, 'D) map'm

Use to implement the map capability for a constant functor.

val pure_of : 'c -> ('c r, 'e, 'a, 'D) pure'm

Use to implement the pure capability for a constant with the given identity element.

val pair_with : 'D -> 'c lazy_op'2 -> ('c r, 'e, 'a, 'b, 'D) pair'm

Use to implement the pair capability for a constant with the given binary combine operator.

class ['c, 'D] product : 'c lazy_op'2 -> object ... end

new product combine creates the dictionary for a constant product functor.

class ['c, 'D] applicative : 'c -> 'c lazy_op'2 -> object ... end

new applicative identity combine creates the dictionary for a constant applicative functor.

OCaml

Innovation. Community. Security.