package rea

  1. Overview
  2. Docs

Module Rea.ConstantSource

Constant functor, products, and applicatives.

Sourcetype 'c r

Abstract effect representation for Constant.

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

Constant injection.

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

Constant projection.

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

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

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

Base constant functor interpreter dictionary.

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

Default functr dictionary.

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

Combines booleans with && lazily.

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

Combines booleans with || lazily.

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

Combines options to return the leftmost some lazily.

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

Combines unit effects with bind.

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

Combines boolean effects with &&& lazily.

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

Combines boolean effects with ||| lazily.

Sourceval 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
Sourceval map : 'D -> ('c r, 'e, 'a, 'b, 'D) map'm

Use to implement the map capability for a constant functor.

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

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

Sourceval 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.

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

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

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

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