package travesty

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

Simultaneous mapping and filtering.

Filter_mappable contains signatures and extensions for types that can be non-monadically mapped over, while simultaneously removing values.

Signatures

Filter_mappable_intf contains the signatures for Filter_mappable.

include module type of Filter_mappable_intf

Basic signatures

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

The generic basic signature

As with Traversable and Mappable, we define the basic and full signatures of filter-mappable structures in an arity-generic way, then specialise them for arity-0 and arity-1 types.

module type Generic_basic = sig ... end

Generic input shape of filter-mappable structures on either an arity-0 or arity-1 type.

Arity-0 and arity-1 basic signatures

module type Basic0 = sig ... end

Basic signature of an arity-0 filter-mappable type.

module type Basic1 = sig ... end

Basic signature of an arity-1 mappable type.

Full signatures

The full signatures are S0 (arity-0) and S1 (arity-1).

The generic signature

module type Generic = sig ... end

Generic output shape of filter-mappable structures on either an arity-0 or arity-1 type.

Arity-0 and arity-1 full signatures

module type S0 = sig ... end

Full signature of an arity-0 filter-mappable type.

module type S1 = sig ... end

Full signature of an arity-1 mappable type.

Making full instances from basic ones

module Make0 (F : Basic0) : S0 with type t := F.t and type elt := F.elt

Make0 makes an S0 from a Basic0.

module Make1 (F : Basic1) : S1 with type 'a t := 'a F.t

Make0 makes an S1 from a Basic1.

Deriving Mappable

module To_mappable0 (F : Basic0) : Mappable.S0 with type t := F.t and type elt := F.elt

To_mappable0 lowers a filter-mappable arity-0 type to a mappable one.

module To_mappable1 (F : Basic1) : Mappable.S1 with type 'a t := 'a F.t

To_mappable1 lowers a filter-mappable arity-1 type to a mappable one.

OCaml

Innovation. Community. Security.