package traverse

  1. Overview
  2. Docs
Traversable data structures with applicative functors

Install

Dune Dependency

Authors

Maintainers

Sources

v0.3.0.tar.gz
sha512=a29798bf912dc2c2ddce06aafc63f88fce4bf5dd35884c2e2c7b7caa1b2d8e95122e6f6d3b675965145853f530fad856740201f2f349561a15e78591a56e10fe

Description

Definition of applicative functors with instances for traversable data structures

Published: 02 Oct 2020

README

traverse: Traversable data structures with applicative functors

This library provides:

  • a module signature Traverse.Applicative.S for applicative functors [McBride and Patterson, 2008],

  • two functions Traverse.list and Traverse.seq to traverse lists and sequences by a given applicative functor and with a given arity,

  • many instances of applicative functors: Traverse.Applicative.{iter, map, reduce, env, fold, pair, forall, exists, option, result, list}.

The purpose of this library is to provide a common dictionary of "visitors", which is orthogonal to the visited data structure. For instance, Traverse.list Traverse.Applicative.iter (S O) is equivalent to List.iter, Traverse.list Traverse.Applicative.map (S (S O)) is equivalent to List.map2, etc. Moreover, one can get a visitor which combine, for instance, both List.map and List.fold_left by invoking Traverse.list Traverse.Applicative.(pair map fold). To get the same visitors for a sequence ('a Seq.t), one just have to replace Traverse.list by Traverse.seq, and it is easy to define a traversal for any algebraic data structures.

Dependencies (5)

  1. metaquot >= "0.3.0"
  2. metapp >= "0.3.0"
  3. stdcompat >= "14"
  4. dune >= "1.11.0"
  5. ocaml >= "4.03.0"

Dev Dependencies (1)

  1. odoc with-doc & >= "1.5.1"

Used by (2)

  1. clangml-transforms >= "0.25"
  2. refl >= "0.3.0"

Conflicts

None

OCaml

Innovation. Community. Security.