package preface

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

Set of interfaces describing all the abstractions available in Preface. For a detailed description of the module breakdown logic, go to the homepage.

Abstraction hierarchy

Monoid hierarchy

module Semigroup : sig ... end

A Semigroup is a type t which provides a binary associative operation combine which lets you combine any two values of t into one.

module Monoid : sig ... end

A Monoid is a type t which provides a binary associative operation combine and a neutral element (neutral). In other words, a Monoid is a Semigroup with a neutral element.

Functor hierarchy

module Invariant : sig ... end

Invariant is and "Invariant Functor". Every Functor and Contravariant is an Invariant Functor.

module Functor : sig ... end

A Functor represents a type that can be mapped over. So we can go from 'a t to 'b t using a function from 'a to 'b. Mapping preserve the structure of the input.

module Alt : sig ... end

Alt is a Functor which is a kind of Semigroup over a parametrized type. In other word, Alt is a Functor with a combine operation.

module Apply : sig ... end

An Apply is a functor with lifting and sequencing capabilities. Apply is more general (and by extension weaker) than a Applicative. An Apply is also a Functor.

module Applicative : sig ... end

An Applicative is a functor with lifting and sequencing capabilities. Applicative is more general (and by extension weaker) than a Monad. An Applicative is also a Functor.

module Alternative : sig ... end

Alternative is a kind of Monoid on Applicative. An Alternative is formally an Applicative with neutral and combine. So an Alternative is also an Applicative (and an Alt which is also a Functor).

module Selective : sig ... end

A Selective (applicative functor) allows to declare effects statically and select which execute dynamically. It is an algebraic structure between Applicative and Monad. A Selective is also an Applicative.

module Bind : sig ... end

A Monad allow to sequences operations that are dependent from one to another, in contrast to Applicative, which executes a series of independent actions.

module Monad : sig ... end

A Monad allow to sequences operations that are dependent from one to another, in contrast to Applicative, which executes a series of independent actions.

module Monad_plus : sig ... end

Monad_plus is a kind of Monoid on Monad. A Monad_plus is formally a Monad with neutral and combine. So a Monad_plus is also a Monad.

module Comonad : sig ... end

A Comonad is the dual of the Monad.

module Foldable : sig ... end

A Foldable is a data structure which can be fold. In other word, reduced to a summary value one element at a time

module Traversable : sig ... end

A Traversable is a data structure that can be traversed from left to right, performing an action on each element.

Contravariant functor hierarchy

module Contravariant : sig ... end

Contravariant is a "Contravariant functor". In other word, Contravariant is the dual of a Functor.

module Divisible : sig ... end

Divisible is a "Contravariant Applicative Functor", in other word, Divisible is the dual of an Applicative

module Decidable : sig ... end

Decidable is a "Contravariant Alternative".

Bifunctor hierarchy

module Bifunctor : sig ... end

A Bifunctor is a type constructor that takes two type arguments and is a Functor (Covariant) in both arguments.

Profunctor hierarchy

module Profunctor : sig ... end

A Profunctor is a type constructor that takes two type arguments and is a Contravariant Functor as first argument and a covariant Functor as second argument.

module Strong : sig ... end

Strong is a Profunctor working on product types.

module Choice : sig ... end

Choice is a Profunctor working on sum types (via Either).

module Closed : sig ... end

Closed is a Profunctor working on exponential types (function).

Arrow hierarchy

module Semigroupoid : sig ... end

A Semigroupoid is Category without the identity.

module Category : sig ... end

A Category is a Semigroupoid with an identity at each object.

module Arrow : sig ... end

An Arrow is an abstract view of computation sitting between Applicative and Monad. Arrow is built on the top of Category and Strong. So an Arrow is also a Category.

module Arrow_zero : sig ... end

An Arrow with a neutral element. So Arrow_zero is also an Arrow.

module Arrow_alt : sig ... end

An Arrow with a combine function. So Arrow_alt is also an Arrow. Arrow_alt is a kind of Alt in the arrow hierarchy.

module Arrow_plus : sig ... end

An Arrow_plus is the conjonction of an Arrow_zero and Arrow_alt. An Arrow_plus is a kind of Monoid in the arrow hierarchy. And it also an Arrow_alt and an Arrow_zero (which is also a Arrow).

module Arrow_choice : sig ... end

An Arrow_choice is an Arrow with conditional capabilities. It is a kind of Selective in the arrow hierarchy. And an Arrow_choice is also Arrow.

module Arrow_apply : sig ... end

An Arrow_apply is an Arrow with application capabilities. An Arrow_apply is also Arrow.

Transformers

Monad Transformers

module Reader : sig ... end

A Reader monad parametrized over an inner Monad and an environment. Reader is a monad transformer.

module Writer : sig ... end

A Writer monad parametrized over an inner Monad and an tape which is a Monoid. Writer is a monad transformer.

module State : sig ... end

A State monad parametrized over an inner Monad and a state (which is an arbitrary type). State is a monad transformer.

Comonad Transformers

module Store : sig ... end

A Store comonad parametrized over an inner Comonad and a store (which is an arbitrary type). Store is a comonad transformer. Store is Costate (the dual of State).

module Env : sig ... end

An Env comonad parametrized over an inner Comonad and an env (which is an arbitrary type). Env is a comonad transformer. Env is Coreader (the dual of Reader).

module Traced : sig ... end

A Traced comonad parametrized over an inner Comonad and a tape (which is an arbitrary type). Traced is a comonad transformer. Traced is Cowriter (the dual of Writer).

Free constructions

module Free_applicative : sig ... end

A Free applicative allows you to build an Preface_specs.Applicative from a given Preface_specs.Functor.

module Free_selective : sig ... end

A Free selective allows you to build a rigid Preface_specs.Selective from a given Preface_specs.Functor.

module Freer_selective : sig ... end

A Freer selective allows you to build a rigid Preface_specs.Selective from a given arbitrary type.

module Free_monad : sig ... end

A Free monad allows you to build a Preface_specs.Monad from a given Preface_specs.Functor.

module Freer_monad : sig ... end

A Freer monad allows you to build a Preface_specs.Monad from an arbitrary type (with one type parameter). It offers the same capabilities as a Preface_specs.Free_monad but benefits from a lighter execution cost.

API Shortcuts

As each module exposes all the components of an abstraction, here is a list of shortcuts to directly denote the full API of an abstraction by using its name in upper case.

module type SEMIGROUP = Semigroup.API
module type MONOID = Monoid.API
module type FUNCTOR = Functor.API
module type BIFUNCTOR = Bifunctor.API
module type PROFUNCTOR = Profunctor.API
module type STRONG = Strong.API
module type CHOICE = Choice.API
module type CLOSED = Closed.API
module type APPLY = Apply.API
module type APPLICATIVE = Applicative.API
module type ALT = Alt.API
module type ALTERNATIVE = Alternative.API
module type SELECTIVE = Selective.API
module type BIND = Bind.API
module type MONAD = Monad.API
module type MONAD_PLUS = Monad_plus.API
module type COMONAD = Comonad.API
module type FOLDABLE = Foldable.API
module type TRAVERSABLE = Traversable.API
module type FREE_APPLICATIVE = Free_applicative.API
module type FREE_SELECTIVE = Free_selective.API
module type FREER_SELECTIVE = Freer_selective.API
module type FREE_MONAD = Free_monad.API
module type FREER_MONAD = Freer_monad.API
module type INVARIANT = Invariant.API
module type CONTRAVARIANT = Contravariant.API
module type DIVISIBLE = Divisible.API
module type SEMIGROUPOID = Semigroupoid.API
module type DECIDABLE = Decidable.API
module type CATEGORY = Category.API
module type ARROW = Arrow.API
module type ARROW_ZERO = Arrow_zero.API
module type ARROW_ALT = Arrow_alt.API
module type ARROW_PLUS = Arrow_plus.API
module type ARROW_CHOICE = Arrow_choice.API
module type ARROW_APPLY = Arrow_apply.API
module type READER = Reader.API
module type WRITER = Writer.API
module type STATE = State.API
module type STORE = Store.API
module type ENV = Env.API
module type TRACED = Traced.API

Types

Sometimes, in order to construct an abstraction, it is only necessary to give it a type (For example, Freer_monad).

module Types : sig ... end

Signatures representing types. Mainly used as a functor parameter

OCaml

Innovation. Community. Security.