package preface

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

Parameters

Signature

include Preface_specs.TRACED with type tape = Tape.t
type tape = Tape.t

The parameter which is a monoid.

type 'a comonad

The inner comonad.

type 'a t = (tape -> 'a) comonad

The type held by the traced comonad.

val lower : 'a t -> 'a comonad

get the underlying comonad.

val run : 'a t -> (tape -> 'a) comonad

Unwrap the traced computation.

val trace : tape -> 'a t -> 'a

Extracts the value at the current position.

val traces : ('a -> tape) -> 'a t -> 'a

Extracts the value at a relative position.

val listen : 'a t -> ('a * tape) t

Get the current position.

val listens : (tape -> 'b) -> 'a t -> ('a * 'b) t

Get the current position relatively.

val censor : (tape -> tape) -> 'a t -> 'a t

Apply a function to the current position.

Comonad

Type

Functions

val duplicate : 'a t -> 'a t t

Dual of join.

val map : ('a -> 'b) -> 'a t -> 'b t

Mapping over from 'a to 'b over 'a t to 'b t.

val extend : ('a t -> 'b) -> 'a t -> 'b t

Dual of bind.

val extract : 'a t -> 'a

Extract a 'a from 'a t. Dual of return.

val compose_left_to_right : ('a t -> 'b) -> ('b t -> 'c) -> 'a t -> 'c

Composing monadic functions using Co-Kleisli Arrow (from left to right).

val lift : ('a -> 'b) -> 'a t -> 'b t

Mapping over from 'a to 'b over 'a t to 'b t.

val lift2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

Mapping over from 'a and 'b to 'c over 'a t and 'b t to 'c t.

val lift3 : ('a -> 'b -> 'c -> 'd) -> 'a t -> 'b t -> 'c t -> 'd t

Mapping over from 'a and 'b and 'c to 'd over 'a t and 'b t and 'c t to 'd t.

val compose_right_to_left : ('b t -> 'c) -> ('a t -> 'b) -> 'a t -> 'c

Composing comonadic functions using Co-Kleisli Arrow (from right to left).

val replace : 'a -> 'b t -> 'a t

Create a new 'a t, replacing all values in the 'b t by given a value of 'a.

val void : 'a t -> unit t

Create a new unit t, replacing all values in the 'a t by unit.

Infix operators

module Infix : Preface_specs.Comonad.INFIX with type 'a t := 'a t
val (=>>) : 'a t -> ('a t -> 'b) -> 'b t

Infix flipped version of CORE.extend.

val (<<=) : ('a t -> 'b) -> 'a t -> 'b t

Infix version of CORE.extend.

val (=>=) : ('a t -> 'b) -> ('b t -> 'c) -> 'a t -> 'c

Infix version of CORE.compose_left_to_right.

val (=<=) : ('b t -> 'c) -> ('a t -> 'b) -> 'a t -> 'c

Infix version of OPERATION.compose_right_to_left.

val (<@@>) : 'a t -> ('a -> 'b) t -> 'b t

Applicative functor of ('a -> 'b) t over 'a t to 'b t.

val (<@>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative functor of ('a -> 'b) t over 'a t to 'b t.

val (@>) : unit t -> 'b t -> 'b t

Discard the value of the first argument.

val (<@) : 'a t -> unit t -> 'a t

Discard the value of the second argument.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t
val (<&>) : 'a t -> ('a -> 'b) -> 'b t

Flipped and infix version of Preface_specs.Functor.CORE.map.

val (<$) : 'a -> 'b t -> 'a t
val ($>) : 'a t -> 'b -> 'b t

Flipped and infix version of Preface_specs.Functor.OPERATION.replace.

Syntax

module Syntax : Preface_specs.Comonad.SYNTAX with type 'a t := 'a t
val let@ : 'a t -> ('a t -> 'b) -> 'b t

Syntaxic shortcuts for version of CORE.extend:

let@ x = e in f is equals to extend f e.

val let+ : 'a t -> ('a -> 'b) -> 'b t

Syntaxic shortcuts for version of CORE.map

val traced : (tape -> 'a) -> 'a t

Promote a function from tape to 'a into a trace.

val run_identity : 'a t -> tape -> 'a

Run the traced through the identity.

Functor

module Functor : Preface_specs.FUNCTOR with type 'a t = 'a t
OCaml

Innovation. Community. Security.