package travesty

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

The main groups of signatures provided by this module are:

  • Basicn: minimal definition of bi-traversable modules;
  • Sn: full bi-traversable containers, produced by applying functors to the above.

We also define other signatures, mostly for internal book-keeping. They may be useful elsewhere, however.

Inner-traversal signatures

These signatures form the inner body of the On_monad functor in the main signatures. They all have names ending with _on_monad, and assume the existence of a monad M.

While they aren't interesting on their own, they do contain (in slightly abstract form) the specific functions needed to build, and provided on building, bi-traversable containers.

The generic signatures

Here, we define some signatures for bi-traversable structures in an arity-generic way. We then specialise them for arity-0 and arity-1 types.

Unlike in Traversal_types, we don't (yet) have any specific types for monadic bi-traversals; this is because we don't derive any operations that only work on monads.

module type Basic_generic_on_applicative = sig ... end

Basic_generic_on_applicative describes applicative bi-traversal on types of any arity.

module type Generic_on_applicative = sig ... end

Generic_on_applicative extends Generic to contain various derived operators; we use it to derive the signatures of the various On modules.

Basic signatures
module type Basic0_on_applicative = sig ... end

Basic0_on_applicative is the inner signature of an applicative bi-traversal over arity-0 types.

module type Basic1_left_on_applicative = sig ... end

Basic1_left_on_applicative is the inner signature of an applicative bi-traversal over arity-1 types with a floating left type and fixed right type.

module type Basic1_right_on_applicative = sig ... end

Basic1_right_on_applicative is the inner signature of a monadic bi-traversal over arity-1 types with a floating right type and fixed left type.

module type Basic2_on_applicative = sig ... end

Basic2_on_applicative is the inner signature of a monadic bi-traversal over arity-2 types with a floating right type and fixed left type.

Basic signatures

We now define basic signatures that generalise the above signatures over all monads.

These signatures form the input to functors that provide derived operations, chaining, type-fixing, and conversion to bi-mappable and regular traversable containers.

The basic signatures are Basic0, which defines traversal across an arity-0 type t (with a fixed, associated element type elt); Basic1_left and Basic1_right, which fix the right and left element type respectively (leaving the named type floating); and Basic2, which defines traversal across an arity-2 type ('l, 'r) t with left element type 'l and right element type 'r.

module type Basic0 = sig ... end

Basic0 is the basic signature of an arity-0 bi-traversable type.

module type Basic1_left = sig ... end

Basic1_left is the basic signature of an arity-1 bi-traversable type with a floating left type and fixed right type.

module type Basic1_right = sig ... end

Basic1_right is the basic signature of an arity-1 bi-traversable type with a floating right type and fixed left type.

module type Basic2 = sig ... end

Basic2 is the signature of an arity-2 bi-traversable type with floating left and right types.

Signatures for bi-traversable types

The signatures below include various functions we can derive from bi-mappable types.

module type Generic = sig ... end

Generic is a generic interface for bi-mappable types, used to build S0 (arity-0) and S1 (arity-1).

module type S0 = sig ... end

S0 is the full signature of an arity-0 bi-traversable type.

module type S1_left = sig ... end

S1_left is the full signature of an arity-1 bi-traversable type with a floating left type and fixed right type.

module type S1_right = sig ... end

S1_right is the full signature of an arity-1 bi-traversable type with a floating right type and fixed left type.

module type S2 = sig ... end

S2 is the full signature of an arity-2 bi-traversable type with floating left and right types.