package irmin-bench

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

See Trace_stat_summary for an explanation and an example.

Heavily inspired by the "repr" library.

Type parameters:

  • 'res is the output of finalise.
  • 'f is the full contructor that creates a 'res.
  • 'v is the output of folder.finalise, one parameter of 'f.
  • 'rest is 'f or 'res or somewhere in between.
  • 'acc is the accumulator of one folder.
  • 'row is what needs to be fed to all folder.accumulate.

Typical use case:

let pf =
  open_ (fun res_a res_b -> my_constructor res_a res_b)
  |+ folder my_acc_a my_accumulate_a my_finalise_a
  |+ folder my_acc_b my_accumulate_b my_finalise_b
  |> seal
in
let res = my_row_sequence |> Seq.fold_left accumulate pf |> finalise in

Section 1/3 - Individual folders

type ('row, 'acc, 'v) folder
val folder : 'acc -> ('acc -> 'row -> 'acc) -> ('acc -> 'v) -> ('row, 'acc, 'v) folder

Create one folder to be passed to an open parallel folder using |+.

Section 2/3 - Open parallel folder

type ('res, 'row, 'v) folders
type ('res, 'row, 'f, 'rest) open_t
val open_ : 'f -> ('res, 'row, 'f, 'f) open_t

Start building a parallel folder.

val app : ('res, 'row, 'f, 'v -> 'rest) open_t -> ('row, 'acc, 'v) folder -> ('res, 'row, 'f, 'rest) open_t

Add a folder to an open parallel folder.

val (|+) : ('res, 'row, 'f, 'v -> 'rest) open_t -> ('row, 'acc, 'v) folder -> ('res, 'row, 'f, 'rest) open_t

Alias for app.

Section 3/3 - Closed parallel folder

type ('res, 'row) t
val seal : ('res, 'row, 'f, 'res) open_t -> ('res, 'row) t

Stop building a parallel folder.

Gotcha: It may seal a partially applied f.

val accumulate : ('res, 'row) t -> 'row -> ('res, 'row) t

Forward a row to all registered functional folders.

val finalise : ('res, 'row) t -> 'res

Finalise all folders and pass their result to the user-defined function provided to open_.

OCaml

Innovation. Community. Security.