package travesty

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

Signatures for (non-monadic) mapping.

The main signatures are S0 and S1. We also define container forms of the above, which include the Base container interfaces, and Extensions1, a signature of extensions to arity-1 mappable containers.

The generic signature

As with Traversable, we define the signature of mappable structures in an arity-generic way, then specialise it for arity-0 and arity-1 types.

module type Generic = sig ... end

Generic describes mapping on either an arity-0 or arity-1 type.

Basic signatures

The basic signatures are S0, which defines mapping across an arity-0 type t (with a fixed, associated element type elt), and S1, which defines mapping across an arity-1 type 'a t (with element type 'a).

module type S0 = sig ... end

S0 is the signature of an arity-0 mappable type.

module type S1 = sig ... end

S1 is the signature of an arity-1 mappable type.

Mappable container signatures

Unlike with Traversable's map_m, we can't actually implement the Core container signatures over map alone. We still define versions of the Mappable interfaces that include their respective container signatures, both for symmetry and to allow for extensions.

module type S0_container = sig ... end

S0_container is the signature of an arity-0 mappable container.

module type S1_container = sig ... end

S1_container is the signature of an arity-1 mappable container.

Extensions

The signatures below describe various functions we can derive from mappable types and mappable containers. To apply them to existing types, use the functors in Mappable.

module type Extensions1 = sig ... end

Extensions1 describes various extensions of arity-1 mappable containers.

OCaml

Innovation. Community. Security.