package encore

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type ('a, 'b) t

Type of a bijective element.

exception Bijection
val v : fwd:('a -> 'b) -> bwd:('b -> 'a) -> ('a, 'b) t

v ~fwd ~bwd is a bijective element such as:

assert (bwd (fwd v) = v) 

Note: This assertion is not proved or checked by v but it is required then.

val bwd : ('a, 'b) t -> 'b -> 'a

bwd t is the backward function of t.

val fwd : ('a, 'b) t -> 'a -> 'b

fwd t is the forward function of t.

val flip : ('a, 'b) t -> ('b, 'a) t

flip t is t where the internal forward function is replaced by the backward function and vice-versa.

val product : ('u, 'v) t -> ('x, 'y) t -> ('u * 'x, 'v * 'y) t
val compose : ('a, 'b) t -> ('b, 'c) t -> ('a, 'c) t
val commute : ('a * 'b, 'b * 'a) t
val identity : ('a, 'a) t
val element : ('a -> bool) -> ('a, 'a) t
val cons : ('a * 'a list, 'a list) t
val char : char -> (char, unit) t
val string : string -> (string, unit) t
val some : ('a, 'a option) t
val obj3 : (('a * 'b) * 'c, 'a * 'b * 'c) t
val obj4 : ((('a * 'b) * 'c) * 'd, 'a * 'b * 'c * 'd) t
val obj5 : (((('a * 'b) * 'c) * 'd) * 'e, 'a * 'b * 'c * 'd * 'e) t
val obj6 : ((((('a * 'b) * 'c) * 'd) * 'e) * 'f, 'a * 'b * 'c * 'd * 'e * 'f) t