package popper

  1. Overview
  2. Docs

Types

This module exposes a type 'a t. A value of type a t is used for comparing and pretty printing values of type a.

type 'a t

Basic operators

val make : ('a -> 'a -> int) -> (Format.formatter -> 'a -> unit) -> 'a t

make compare pp constructs a comparator using the given compare to compare value and pp to print them.

val compare : 'a t -> 'a -> 'a -> int

compare c x y compares x and y using the c comparator.

val pp : 'a t -> Format.formatter -> 'a -> unit

pp c x prints x using the c comparator.

Primitive comparators

val int : int t

int is an integer comparator.

val float : float t

float is a float comparator.

val bool : bool t

bool is a bool comparator.

val string : string t

string is a string comparator.

Combinators
val tuple : 'a t -> 'b t -> ('a * 'b) t

tuple c1 c2 creates a comparator for tuples using the comparators c1 and c2.

val list : 'a t -> 'a list t

tuple c creates a comparator for lists using the the comparator c.

val array : 'a t -> 'a array t

array c creates a comparator for arrays using the the comparator c.

val option : 'a t -> 'a option t

option c creates a comparator for options using the the comparator c.

val result : ok:'a t -> error:'e t -> ('a, 'e) result t

option ~ok ~error creates a comparator for result values using the the comparators ok and error.

OCaml

Innovation. Community. Security.