package travesty

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

Signatures for monadic traversal.

The generic signature

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

module type Generic = sig ... end

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

Basic signatures

module type S0 = sig ... end

S0 is the signature of a monadic traversal over arity-0 types.

module type S1 = sig ... end

S1 is the signature of a monadic traversal over arity-1 types.

Building containers from traversable types

Any traversable type can be turned into a Core container, using the monadic fold to implement all container functionality. The unified signature of a Core container with monadic traversals is S0_container (arity 0) or S1_container (arity 1).

To satisfy these signatures for new types, implement Basic0 or Basic1, and use the corresponding Make functor in Traversable.

For types that are _already_ Core containers, or types where custom implementation of the Core signature are desired, implement Basic_container0 or Basic_container1, and use the Extend functors.

Input signatures

module type Basic0 = sig ... end

Basic0 is the minimal signature that traversable containers of arity 0 must implement to be extensible into S0_container.

module type Basic_container0 = sig ... end

Basic_container0 combines Basic0 and the Core container signature, and is used for extending existing containers into S0_containers.

module type Basic1 = sig ... end

Basic1 is the minimal signature that traversable containers of arity 1 must implement to be extensible into.

module type Basic_container1 = sig ... end

Basic_container1 combines Basic1 and the Core container signature, and is used for extending existing containers into S1_containers.

Helper signatures

module type Generic_on_monad = sig ... end

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

module type On_monad1 = sig ... end

On_monad1 extends Generic_on_monad with functionality that only works on arity-1 containers.

module type Generic_container = sig ... end

Generic_container is a generic interface for traversable containers, used to build Container0 (arity-0) and Container1 (arity-1).

Signatures for traversable containers

module type S0_container = sig ... end

S0_container is a generic interface for arity-0 traversable containers.

module type S1_container = sig ... end

S1_container is a generic interface for arity-1 traversable containers. It also includes the extensions from Mappable.

OCaml

Innovation. Community. Security.