Module Preface_specs.Functor

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.

Laws

To have a predictable behaviour, the instance of Functor must obey some laws.

  1. map id = id;
  2. map (f % g) = map f % map g.

Minimal definition

module type WITH_MAP = sig ... end

The minimum definition of a Functor. It is by using the combinators of this module that the other combinators will be derived.

Structure anatomy

module type CORE = WITH_MAP

Basis operations.

module type OPERATION = sig ... end

Additional operations.

module type INFIX = sig ... end

Infix operators.

module type SYNTAX = sig ... end

Syntax operators.

Complete API

module type API = sig ... end

The complete interface of a Functor.

Additional references