diff --git a/dev/containers-thread/CCPool/Make/Fut/Infix/index.html b/dev/containers-thread/CCPool/Make/Fut/Infix/index.html index 53af3a81..c59d8f9f 100644 --- a/dev/containers-thread/CCPool/Make/Fut/Infix/index.html +++ b/dev/containers-thread/CCPool/Make/Fut/Infix/index.html @@ -1,2 +1,2 @@ -Infix (containers-thread.CCPool.Make.Fut.Infix)

Module Fut.Infix

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>) : 'a t -> (unit -> 'b t) -> 'b t
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
include CCShims_syntax.LET with type 'a t := 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file +Infix (containers-thread.CCPool.Make.Fut.Infix)

Module Fut.Infix

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>) : 'a t -> (unit -> 'b t) -> 'b t
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers-thread/CCPool/Make/Fut/index.html b/dev/containers-thread/CCPool/Make/Fut/index.html index e3a997fb..055ba515 100644 --- a/dev/containers-thread/CCPool/Make/Fut/index.html +++ b/dev/containers-thread/CCPool/Make/Fut/index.html @@ -1,2 +1,2 @@ -Fut (containers-thread.CCPool.Make.Fut)

Module Make.Fut

Futures

The futures are registration points for callbacks, storing a state, that are executed in the pool using run.

type 'a t

A future value of type 'a

type 'a future = 'a t

Constructors

val return : 'a -> 'a t

Future that is already computed.

val fail : exn -> 'a t

Future that fails immediately.

val make : (unit -> 'a) -> 'a t

Create a future, representing a value that will be computed by the function. If the function raises, the future will fail.

val make1 : ('a -> 'b) -> 'a -> 'b t
val make2 : ('a -> 'b -> 'c) -> 'a -> 'b -> 'c t

Basics

val get : 'a t -> 'a

Blocking get: wait for the future to be evaluated, and get the value, or the exception that failed the future is returned. Raise e if the future failed with e.

val state : 'a t -> 'a state

State of the future.

val is_done : 'a t -> bool

Is the future evaluated (success/failure)?

Combinators

val on_success : 'a t -> ('a -> unit) -> unit

Attach a handler to be called upon success. The handler should not call functions on the future. Might be evaluated now if the future is already done.

val on_failure : _ t -> (exn -> unit) -> unit

Attach a handler to be called upon failure. The handler should not call any function on the future. Might be evaluated now if the future is already done.

val on_finish : 'a t -> ('a state -> unit) -> unit

Attach a handler to be called when the future is evaluated. The handler should not call functions on the future. Might be evaluated now if the future is already done.

val flat_map : ('a -> 'b t) -> 'a t -> 'b t

Monadic combination of futures.

val and_then : 'a t -> (unit -> 'b t) -> 'b t

Wait for the first future to succeed, then launch the second.

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

Future that waits for all previous futures to terminate. If any future in the array fails, sequence_a l fails too.

val map_a : ('a -> 'b t) -> 'a array -> 'b array t

map_a f a maps f on every element of a, and will return the array of every result if all calls succeed, or an error otherwise.

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

Future that waits for all previous futures to terminate. If any future in the list fails, sequence_l l fails too.

val map_l : ('a -> 'b t) -> 'a list -> 'b list t

map_l f l maps f on every element of l, and will return the list of every result if all calls succeed, or an error otherwise.

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

Choose among those futures (the first to terminate). Behaves like the first future that terminates, by failing if the future fails.

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

Choose among those futures (the first to terminate). Behaves like the first future that terminates, by failing if the future fails.

val map : ('a -> 'b) -> 'a t -> 'b t

Map the value inside the future. The function doesn't run in its own task; if it can take time, use flat_map or map_async.

val map_async : ('a -> 'b) -> 'a t -> 'b t

Map the value inside the future, to be computed in a separated job.

val monoid_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

Cartesian product of the content of these futures.

  • since 2.8
val app : ('a -> 'b) t -> 'a t -> 'b t

app f x applies the result of f to the result of x.

val app_async : ('a -> 'b) t -> 'a t -> 'b t

app_async f x applies the result of f to the result of x, in a separated job scheduled in the pool.

val sleep : float -> unit t

Future that returns with success in the given amount of seconds. Blocks the thread! If you need to wait on many events, consider using CCTimer.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>) : 'a t -> (unit -> 'b t) -> 'b t
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
include CCShims_syntax.LET with type 'a t := 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file +Fut (containers-thread.CCPool.Make.Fut)

Module Make.Fut

Futures

The futures are registration points for callbacks, storing a state, that are executed in the pool using run.

type 'a t

A future value of type 'a

type 'a future = 'a t

Constructors

val return : 'a -> 'a t

Future that is already computed.

val fail : exn -> 'a t

Future that fails immediately.

val make : (unit -> 'a) -> 'a t

Create a future, representing a value that will be computed by the function. If the function raises, the future will fail.

val make1 : ('a -> 'b) -> 'a -> 'b t
val make2 : ('a -> 'b -> 'c) -> 'a -> 'b -> 'c t

Basics

val get : 'a t -> 'a

Blocking get: wait for the future to be evaluated, and get the value, or the exception that failed the future is returned. Raise e if the future failed with e.

val state : 'a t -> 'a state

State of the future.

val is_done : 'a t -> bool

Is the future evaluated (success/failure)?

Combinators

val on_success : 'a t -> ('a -> unit) -> unit

Attach a handler to be called upon success. The handler should not call functions on the future. Might be evaluated now if the future is already done.

val on_failure : _ t -> (exn -> unit) -> unit

Attach a handler to be called upon failure. The handler should not call any function on the future. Might be evaluated now if the future is already done.

val on_finish : 'a t -> ('a state -> unit) -> unit

Attach a handler to be called when the future is evaluated. The handler should not call functions on the future. Might be evaluated now if the future is already done.

val flat_map : ('a -> 'b t) -> 'a t -> 'b t

Monadic combination of futures.

val and_then : 'a t -> (unit -> 'b t) -> 'b t

Wait for the first future to succeed, then launch the second.

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

Future that waits for all previous futures to terminate. If any future in the array fails, sequence_a l fails too.

val map_a : ('a -> 'b t) -> 'a array -> 'b array t

map_a f a maps f on every element of a, and will return the array of every result if all calls succeed, or an error otherwise.

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

Future that waits for all previous futures to terminate. If any future in the list fails, sequence_l l fails too.

val map_l : ('a -> 'b t) -> 'a list -> 'b list t

map_l f l maps f on every element of l, and will return the list of every result if all calls succeed, or an error otherwise.

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

Choose among those futures (the first to terminate). Behaves like the first future that terminates, by failing if the future fails.

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

Choose among those futures (the first to terminate). Behaves like the first future that terminates, by failing if the future fails.

val map : ('a -> 'b) -> 'a t -> 'b t

Map the value inside the future. The function doesn't run in its own task; if it can take time, use flat_map or map_async.

val map_async : ('a -> 'b) -> 'a t -> 'b t

Map the value inside the future, to be computed in a separated job.

val monoid_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

Cartesian product of the content of these futures.

  • since 2.8
val app : ('a -> 'b) t -> 'a t -> 'b t

app f x applies the result of f to the result of x.

val app_async : ('a -> 'b) t -> 'a t -> 'b t

app_async f x applies the result of f to the result of x, in a separated job scheduled in the pool.

val sleep : float -> unit t

Future that returns with success in the given amount of seconds. Blocks the thread! If you need to wait on many events, consider using CCTimer.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (>>) : 'a t -> (unit -> 'b t) -> 'b t
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCArray/Infix/index.html b/dev/containers/CCArray/Infix/index.html index adeea089..414c93c8 100644 --- a/dev/containers/CCArray/Infix/index.html +++ b/dev/containers/CCArray/Infix/index.html @@ -1,2 +1,2 @@ -Infix (containers.CCArray.Infix)

Module CCArray.Infix

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

val let+ : 'a array -> ('a -> 'b) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ('a -> 'b array) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file +Infix (containers.CCArray.Infix)

Module CCArray.Infix

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCArray/index.html b/dev/containers/CCArray/index.html index f07e5f2f..94f4c3c8 100644 --- a/dev/containers/CCArray/index.html +++ b/dev/containers/CCArray/index.html @@ -17,4 +17,4 @@ (module MONO_ARRAY with type elt = 'elt and type t = 'arr) -> cmp:('elt -> 'elt -> int) -> 'arr -> - unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

Infix Operators

It is convenient to open CCArray.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a array -> ('a -> 'b) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ('a -> 'b array) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file + unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

Infix Operators

It is convenient to open CCArray.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCArrayLabels/Infix/index.html b/dev/containers/CCArrayLabels/Infix/index.html index 6751ea76..198f6e32 100644 --- a/dev/containers/CCArrayLabels/Infix/index.html +++ b/dev/containers/CCArrayLabels/Infix/index.html @@ -1,2 +1,2 @@ -Infix (containers.CCArrayLabels.Infix)

Module CCArrayLabels.Infix

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

val let+ : 'a array -> ('a -> 'b) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ('a -> 'b array) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file +Infix (containers.CCArrayLabels.Infix)

Module CCArrayLabels.Infix

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCArrayLabels/index.html b/dev/containers/CCArrayLabels/index.html index 2d394fd4..b0cc6b5a 100644 --- a/dev/containers/CCArrayLabels/index.html +++ b/dev/containers/CCArrayLabels/index.html @@ -31,4 +31,4 @@ (module MONO_ARRAY with type elt = 'elt and type t = 'arr) -> cmp:('elt -> 'elt -> int) -> 'arr -> - unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

Infix Operators

It is convenient to open CCArray.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a array -> ('a -> 'b) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ('a -> 'b array) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file + unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

Infix Operators

It is convenient to open CCArray.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ('a -> 'b) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCFloat/index.html b/dev/containers/CCFloat/index.html index f9ca6f38..821d3479 100644 --- a/dev/containers/CCFloat/index.html +++ b/dev/containers/CCFloat/index.html @@ -1,2 +1,2 @@ -CCFloat (containers.CCFloat)

Module CCFloat

Basic operations on floating-point numbers

type t = float
type fpclass = CCShims_.Stdlib.fpclass =
  1. | FP_normal
  2. | FP_subnormal
  3. | FP_zero
  4. | FP_infinite
  5. | FP_nan
val nan : t

nan is Not a Number (NaN). Equal to Stdlib.nan.

val max_value : t

max_value is Positive infinity. Equal to Stdlib.infinity.

val min_value : t

min_value is Negative infinity. Equal to Stdlib.neg_infinity.

val max_finite_value : t

max_finite_value is the largest finite float value. Equal to Stdlib.max_float.

val epsilon : t

epsilon is the smallest positive float x such that 1.0 +. x <> 1.0. Equal to Stdlib.epsilon_float.

val pi : t

pi is the constant pi. The ratio of a circumference to its diameter.

  • since 3.0
val is_nan : t -> bool

is_nan f returns true if f is NaN, false otherwise.

val add : t -> t -> t

add x y is equal to x +. y.

val sub : t -> t -> t

sub x y is equal to x -. y.

val neg : t -> t

neg x is equal to ~-. x.

val abs : t -> t

abs x is the absolute value of the floating-point number x. Equal to Stdlib.abs_float.

val scale : t -> t -> t

scale x y is equal to x *. y.

val min : t -> t -> t

min x y returns the min of the two given values x and y.

val max : t -> t -> t

max x y returns the max of the two given values x and y.

val equal : t -> t -> bool

equal x y is true if x and y are the same.

val compare : t -> t -> int

compare x y is Stdlib.comparexy.

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val pp : t printer
val hash : t -> int
val random : t -> t random_gen
val random_small : t random_gen
val random_range : t -> t -> t random_gen
val fsign : t -> t

fsign x is one of -1., -0., +0., +1., or nan if x is NaN.

  • since 0.7
val round : t -> t

round x returns the closest integer value, either above or below. For n + 0.5, round returns n.

  • since 0.20
exception TrapNaN of string
val sign_exn : t -> int

sign_exn x will return the sign of x as 1, 0 or -1, or raise an exception TrapNaN if x is NaN. Note that infinities have defined signs in OCaml.

  • since 0.7
val to_int : t -> int

Alias to int_of_float. Unspecified if outside of the range of integers.

val of_int : int -> t

Alias to float_of_int.

val to_string : t -> string
val of_string_exn : string -> t

Alias to float_of_string.

  • raises Failure

    in case of failure.

  • since 1.2
val of_string_opt : string -> t option
  • since 3.0
val equal_precision : epsilon:t -> t -> t -> bool

Equality with allowed error up to a non negative epsilon value.

val classify : t -> fpclass

classify x returns the class of the given floating-point number x: normal, subnormal, zero, infinite or nan (not a number).

Infix Operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 0.17
val (<>) : t -> t -> bool
  • since 0.17
val (<) : t -> t -> bool
  • since 0.17
val (>) : t -> t -> bool
  • since 0.17
val (<=) : t -> t -> bool
  • since 0.17
val (>=) : t -> t -> bool
  • since 0.17
val (+) : t -> t -> t

Addition.

  • since 2.1
val (-) : t -> t -> t

Subtraction.

  • since 2.1
val (~-) : t -> t

Unary negation.

  • since 2.1
val (*) : t -> t -> t

Multiplication.

  • since 2.1
val (/) : t -> t -> t

Division.

  • since 2.1
\ No newline at end of file +CCFloat (containers.CCFloat)

Module CCFloat

Basic operations on floating-point numbers

type t = float
type fpclass = fpclass =
  1. | FP_normal
  2. | FP_subnormal
  3. | FP_zero
  4. | FP_infinite
  5. | FP_nan
val nan : t

nan is Not a Number (NaN). Equal to Stdlib.nan.

val max_value : t

max_value is Positive infinity. Equal to Stdlib.infinity.

val min_value : t

min_value is Negative infinity. Equal to Stdlib.neg_infinity.

val max_finite_value : t

max_finite_value is the largest finite float value. Equal to Stdlib.max_float.

val epsilon : t

epsilon is the smallest positive float x such that 1.0 +. x <> 1.0. Equal to Stdlib.epsilon_float.

val pi : t

pi is the constant pi. The ratio of a circumference to its diameter.

  • since 3.0
val is_nan : t -> bool

is_nan f returns true if f is NaN, false otherwise.

val add : t -> t -> t

add x y is equal to x +. y.

val sub : t -> t -> t

sub x y is equal to x -. y.

val neg : t -> t

neg x is equal to ~-. x.

val abs : t -> t

abs x is the absolute value of the floating-point number x. Equal to Stdlib.abs_float.

val scale : t -> t -> t

scale x y is equal to x *. y.

val min : t -> t -> t

min x y returns the min of the two given values x and y.

val max : t -> t -> t

max x y returns the max of the two given values x and y.

val equal : t -> t -> bool

equal x y is true if x and y are the same.

val compare : t -> t -> int

compare x y is Stdlib.comparexy.

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val pp : t printer
val hash : t -> int
val random : t -> t random_gen
val random_small : t random_gen
val random_range : t -> t -> t random_gen
val fsign : t -> t

fsign x is one of -1., -0., +0., +1., or nan if x is NaN.

  • since 0.7
val round : t -> t

round x returns the closest integer value, either above or below. For n + 0.5, round returns n.

  • since 0.20
exception TrapNaN of string
val sign_exn : t -> int

sign_exn x will return the sign of x as 1, 0 or -1, or raise an exception TrapNaN if x is NaN. Note that infinities have defined signs in OCaml.

  • since 0.7
val to_int : t -> int

Alias to int_of_float. Unspecified if outside of the range of integers.

val of_int : int -> t

Alias to float_of_int.

val to_string : t -> string
val of_string_exn : string -> t

Alias to float_of_string.

  • raises Failure

    in case of failure.

  • since 1.2
val of_string_opt : string -> t option
  • since 3.0
val equal_precision : epsilon:t -> t -> t -> bool

Equality with allowed error up to a non negative epsilon value.

val classify : t -> fpclass

classify x returns the class of the given floating-point number x: normal, subnormal, zero, infinite or nan (not a number).

Infix Operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 0.17
val (<>) : t -> t -> bool
  • since 0.17
val (<) : t -> t -> bool
  • since 0.17
val (>) : t -> t -> bool
  • since 0.17
val (<=) : t -> t -> bool
  • since 0.17
val (>=) : t -> t -> bool
  • since 0.17
val (+) : t -> t -> t

Addition.

  • since 2.1
val (-) : t -> t -> t

Subtraction.

  • since 2.1
val (~-) : t -> t

Unary negation.

  • since 2.1
val (*) : t -> t -> t

Multiplication.

  • since 2.1
val (/) : t -> t -> t

Division.

  • since 2.1
\ No newline at end of file diff --git a/dev/containers/CCOpt/Infix/index.html b/dev/containers/CCOpt/Infix/index.html index 26a4f68c..f87abe5b 100644 --- a/dev/containers/CCOpt/Infix/index.html +++ b/dev/containers/CCOpt/Infix/index.html @@ -1,2 +1,2 @@ -Infix (containers.CCOpt.Infix)

Module CCOpt.Infix

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file +Infix (containers.CCOpt.Infix)

Module CCOpt.Infix

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCOpt/index.html b/dev/containers/CCOpt/index.html index d7d01ef8..fdd94860 100644 --- a/dev/containers/CCOpt/index.html +++ b/dev/containers/CCOpt/index.html @@ -1,2 +1,2 @@ -CCOpt (containers.CCOpt)

Module CCOpt

Previous Option module

include module type of CCOption
type +'a t = 'a option
val map : ('a -> 'b) -> 'a t -> 'b t

map f o applies the function f to the element inside o, if any.

val map_or : default:'b -> ('a -> 'b) -> 'a t -> 'b

map_or ~default f o is f x if o = Some x, default otherwise.

  • since 0.16
val map_lazy : (unit -> 'b) -> ('a -> 'b) -> 'a t -> 'b

map_lazy default_fn f o is f x if o = Some x, default_fn () otherwise.

  • since 1.2
val is_some : _ t -> bool

is_some (Some x) returns true otherwise it returns false.

val is_none : _ t -> bool

is_none None returns true otherwise it returns false.

  • since 0.11
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare comp o1 o2 compares two options o1 and o2, using custom comparators comp for the value. None is always assumed to be less than Some _.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p o1 o2 tests for equality between option types o1 and o2, using a custom equality predicate p.

val return : 'a -> 'a t

return x is a monadic return, that is return x = Some x.

val some : 'a -> 'a t

Alias to return.

  • since 3.5
val none : 'a t

Alias to None.

  • since 3.5
val flat_map : ('a -> 'b t) -> 'a t -> 'b t

flat_map f o is equivalent to map followed by flatten. Flip version of (>>=).

val flat_map_l : ('a -> 'b list) -> 'a t -> 'b list

flat_map_l f o is [] if o is None, or f x if o is Some x.

  • since 3.12
val bind : 'a t -> ('a -> 'b t) -> 'b t

bind o f is f v if o is Some v, None otherwise. Monadic bind.

  • since 3.0
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 f o1 o2 maps 'a option and 'b option to a 'c option using f.

val iter : ('a -> unit) -> 'a t -> unit

iter f o applies f to o. Iterate on 0 or 1 element.

val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a

fold f init o is f init x if o is Some x, or init if o is None. Fold on 0 or 1 element.

val filter : ('a -> bool) -> 'a t -> 'a t

filter f o returns Some x if o is Some x and f x is true, or None if f x is false or if o is None. Filter on 0 or 1 element.

  • since 0.5
val if_ : ('a -> bool) -> 'a -> 'a option

if_ f x is Some x if f x, None otherwise.

  • since 0.17
val exists : ('a -> bool) -> 'a t -> bool

exists f o returns true iff there exists an element for which the provided function f evaluates to true.

  • since 0.17
val for_all : ('a -> bool) -> 'a t -> bool

for_all f o returns true iff the provided function f evaluates to true for all elements.

  • since 0.17
val get_or : default:'a -> 'a t -> 'a

get_or ~default o extracts the value from o, or returns default if o is None.

  • since 0.18
val value : 'a t -> default:'a -> 'a

value o ~default is similar to the Stdlib's Option.value and to get_or.

  • since 2.8
val get_exn : 'a t -> 'a

get_exn o returns x if o is Some x or fails if o is None.

  • raises Invalid_argument

    if the option is None.

val get_exn_or : string -> 'a t -> 'a

get_exn_or msg o returns x if o is Some x or fails with Invalid_argument msg if o is None.

  • raises Invalid_argument

    if the option is None.

  • since 3.4
val get_lazy : (unit -> 'a) -> 'a t -> 'a

get_lazy default_fn o unwraps o, but if o is None it returns default_fn () instead.

  • since 0.6.1
val sequence_l : 'a t list -> 'a list t

sequence_l [x1; x2; …; xn] returns Some [y1; y2; …; yn] if every xi is Some yi. Otherwise, if the list contains at least one None, the result is None.

val wrap : ?handler:(exn -> bool) -> ('a -> 'b) -> 'a -> 'b option

wrap ?handler f x calls f x and returns Some y if f x = y. If f x raises any exception, the result is None. This can be useful to wrap functions such as Map.S.find.

  • parameter handler

    the exception handler, which returns true if the exception is to be caught.

val wrap2 : ?handler:(exn -> bool) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c option

wrap2 ?handler f x y is similar to wrap but for binary functions.

Applicative

val pure : 'a -> 'a t

pure x is an alias to return.

Alternatives

val or_ : else_:'a t -> 'a t -> 'a t

or_ ~else_ o is o if o is Some _, else_ if o is None.

  • since 1.2
val or_lazy : else_:(unit -> 'a t) -> 'a t -> 'a t

or_lazy ~else_ o is o if o is Some _, else_ () if o is None.

  • since 1.2
val choice : 'a t list -> 'a t

choice lo returns the first non-None element of the list lo, or None.

val flatten : 'a t t -> 'a t

flatten oo transforms Some x into x.

  • since 2.2
val return_if : bool -> 'a -> 'a t

return_if b x applies Some or None depending on the boolean b. More precisely, return_if false x is None, and return_if true x is Some x.

  • since 2.2

Infix Operators

  • since 0.16
module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Conversion and IO

val to_list : 'a t -> 'a list

to_list o returns [x] if o is Some x or the empty list [] if o is None.

val of_list : 'a list -> 'a t

of_list l returns Some x (x being the head of the list l), or None if l is the empty list.

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

to_result e o returns Ok x if o is Some x, or Error e if o is None.

  • since 1.2
val to_result_lazy : (unit -> 'e) -> 'a t -> ('a, 'e) result

to_result_lazy f o returns Ok x if o is Some x or Error f if o is None.

  • since 1.2
val of_result : ('a, _) result -> 'a t

of_result result returns an option from a result.

  • since 1.2
type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val random : 'a random_gen -> 'a t random_gen
val choice_iter : 'a t iter -> 'a t

choice_iter iter is similar to choice, but works on iter. It returns the first Some x occurring in iter, or None otherwise.

  • since 3.0
val choice_seq : 'a t Stdlib.Seq.t -> 'a t

choice_seq seq works on Seq.t. It returns the first Some x occurring in seq, or None otherwise.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen o is o as a gen. Some x is the singleton gen containing x and None is the empty gen.

val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq o is o as a sequence Seq.t. Some x is the singleton sequence containing x and None is the empty sequence. Same as Stdlib.Option.to_seq Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter : 'a t -> 'a iter

to_iter o returns an internal iterator, like in the library Iter.

  • since 2.8
val pp : 'a printer -> 'a t printer

pp ppf o pretty-prints option o using ppf.

\ No newline at end of file +CCOpt (containers.CCOpt)

Module CCOpt

Previous Option module

include module type of CCOption
type +'a t = 'a option
val map : ('a -> 'b) -> 'a t -> 'b t

map f o applies the function f to the element inside o, if any.

val map_or : default:'b -> ('a -> 'b) -> 'a t -> 'b

map_or ~default f o is f x if o = Some x, default otherwise.

  • since 0.16
val map_lazy : (unit -> 'b) -> ('a -> 'b) -> 'a t -> 'b

map_lazy default_fn f o is f x if o = Some x, default_fn () otherwise.

  • since 1.2
val is_some : _ t -> bool

is_some (Some x) returns true otherwise it returns false.

val is_none : _ t -> bool

is_none None returns true otherwise it returns false.

  • since 0.11
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare comp o1 o2 compares two options o1 and o2, using custom comparators comp for the value. None is always assumed to be less than Some _.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p o1 o2 tests for equality between option types o1 and o2, using a custom equality predicate p.

val return : 'a -> 'a t

return x is a monadic return, that is return x = Some x.

val some : 'a -> 'a t

Alias to return.

  • since 3.5
val none : 'a t

Alias to None.

  • since 3.5
val flat_map : ('a -> 'b t) -> 'a t -> 'b t

flat_map f o is equivalent to map followed by flatten. Flip version of (>>=).

val flat_map_l : ('a -> 'b list) -> 'a t -> 'b list

flat_map_l f o is [] if o is None, or f x if o is Some x.

  • since 3.12
val bind : 'a t -> ('a -> 'b t) -> 'b t

bind o f is f v if o is Some v, None otherwise. Monadic bind.

  • since 3.0
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 f o1 o2 maps 'a option and 'b option to a 'c option using f.

val iter : ('a -> unit) -> 'a t -> unit

iter f o applies f to o. Iterate on 0 or 1 element.

val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a

fold f init o is f init x if o is Some x, or init if o is None. Fold on 0 or 1 element.

val filter : ('a -> bool) -> 'a t -> 'a t

filter f o returns Some x if o is Some x and f x is true, or None if f x is false or if o is None. Filter on 0 or 1 element.

  • since 0.5
val if_ : ('a -> bool) -> 'a -> 'a option

if_ f x is Some x if f x, None otherwise.

  • since 0.17
val exists : ('a -> bool) -> 'a t -> bool

exists f o returns true iff there exists an element for which the provided function f evaluates to true.

  • since 0.17
val for_all : ('a -> bool) -> 'a t -> bool

for_all f o returns true iff the provided function f evaluates to true for all elements.

  • since 0.17
val get_or : default:'a -> 'a t -> 'a

get_or ~default o extracts the value from o, or returns default if o is None.

  • since 0.18
val value : 'a t -> default:'a -> 'a

value o ~default is similar to the Stdlib's Option.value and to get_or.

  • since 2.8
val get_exn : 'a t -> 'a

get_exn o returns x if o is Some x or fails if o is None.

  • raises Invalid_argument

    if the option is None.

val get_exn_or : string -> 'a t -> 'a

get_exn_or msg o returns x if o is Some x or fails with Invalid_argument msg if o is None.

  • raises Invalid_argument

    if the option is None.

  • since 3.4
val get_lazy : (unit -> 'a) -> 'a t -> 'a

get_lazy default_fn o unwraps o, but if o is None it returns default_fn () instead.

  • since 0.6.1
val sequence_l : 'a t list -> 'a list t

sequence_l [x1; x2; …; xn] returns Some [y1; y2; …; yn] if every xi is Some yi. Otherwise, if the list contains at least one None, the result is None.

val wrap : ?handler:(exn -> bool) -> ('a -> 'b) -> 'a -> 'b option

wrap ?handler f x calls f x and returns Some y if f x = y. If f x raises any exception, the result is None. This can be useful to wrap functions such as Map.S.find.

  • parameter handler

    the exception handler, which returns true if the exception is to be caught.

val wrap2 : ?handler:(exn -> bool) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c option

wrap2 ?handler f x y is similar to wrap but for binary functions.

Applicative

val pure : 'a -> 'a t

pure x is an alias to return.

Alternatives

val or_ : else_:'a t -> 'a t -> 'a t

or_ ~else_ o is o if o is Some _, else_ if o is None.

  • since 1.2
val or_lazy : else_:(unit -> 'a t) -> 'a t -> 'a t

or_lazy ~else_ o is o if o is Some _, else_ () if o is None.

  • since 1.2
val choice : 'a t list -> 'a t

choice lo returns the first non-None element of the list lo, or None.

val flatten : 'a t t -> 'a t

flatten oo transforms Some x into x.

  • since 2.2
val return_if : bool -> 'a -> 'a t

return_if b x applies Some or None depending on the boolean b. More precisely, return_if false x is None, and return_if true x is Some x.

  • since 2.2

Infix Operators

  • since 0.16
module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Conversion and IO

val to_list : 'a t -> 'a list

to_list o returns [x] if o is Some x or the empty list [] if o is None.

val of_list : 'a list -> 'a t

of_list l returns Some x (x being the head of the list l), or None if l is the empty list.

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

to_result e o returns Ok x if o is Some x, or Error e if o is None.

  • since 1.2
val to_result_lazy : (unit -> 'e) -> 'a t -> ('a, 'e) result

to_result_lazy f o returns Ok x if o is Some x or Error f if o is None.

  • since 1.2
val of_result : ('a, _) result -> 'a t

of_result result returns an option from a result.

  • since 1.2
type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val random : 'a random_gen -> 'a t random_gen
val choice_iter : 'a t iter -> 'a t

choice_iter iter is similar to choice, but works on iter. It returns the first Some x occurring in iter, or None otherwise.

  • since 3.0
val choice_seq : 'a t Stdlib.Seq.t -> 'a t

choice_seq seq works on Seq.t. It returns the first Some x occurring in seq, or None otherwise.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen o is o as a gen. Some x is the singleton gen containing x and None is the empty gen.

val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq o is o as a sequence Seq.t. Some x is the singleton sequence containing x and None is the empty sequence. Same as Stdlib.Option.to_seq Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter : 'a t -> 'a iter

to_iter o returns an internal iterator, like in the library Iter.

  • since 2.8
val pp : 'a printer -> 'a t printer

pp ppf o pretty-prints option o using ppf.

\ No newline at end of file diff --git a/dev/containers/CCOption/Infix/index.html b/dev/containers/CCOption/Infix/index.html index 9df67a32..9e303c5c 100644 --- a/dev/containers/CCOption/Infix/index.html +++ b/dev/containers/CCOption/Infix/index.html @@ -1,2 +1,2 @@ -Infix (containers.CCOption.Infix)

Module CCOption.Infix

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file +Infix (containers.CCOption.Infix)

Module CCOption.Infix

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCOption/index.html b/dev/containers/CCOption/index.html index be8933cb..562e42ff 100644 --- a/dev/containers/CCOption/index.html +++ b/dev/containers/CCOption/index.html @@ -1,2 +1,2 @@ -CCOption (containers.CCOption)

Module CCOption

Basic operations on the option type.

This module replaces `CCOpt`.

type +'a t = 'a option
val map : ('a -> 'b) -> 'a t -> 'b t

map f o applies the function f to the element inside o, if any.

val map_or : default:'b -> ('a -> 'b) -> 'a t -> 'b

map_or ~default f o is f x if o = Some x, default otherwise.

  • since 0.16
val map_lazy : (unit -> 'b) -> ('a -> 'b) -> 'a t -> 'b

map_lazy default_fn f o is f x if o = Some x, default_fn () otherwise.

  • since 1.2
val is_some : _ t -> bool

is_some (Some x) returns true otherwise it returns false.

val is_none : _ t -> bool

is_none None returns true otherwise it returns false.

  • since 0.11
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare comp o1 o2 compares two options o1 and o2, using custom comparators comp for the value. None is always assumed to be less than Some _.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p o1 o2 tests for equality between option types o1 and o2, using a custom equality predicate p.

val return : 'a -> 'a t

return x is a monadic return, that is return x = Some x.

val some : 'a -> 'a t

Alias to return.

  • since 3.5
val none : 'a t

Alias to None.

  • since 3.5
val flat_map : ('a -> 'b t) -> 'a t -> 'b t

flat_map f o is equivalent to map followed by flatten. Flip version of (>>=).

val flat_map_l : ('a -> 'b list) -> 'a t -> 'b list

flat_map_l f o is [] if o is None, or f x if o is Some x.

  • since 3.12
val bind : 'a t -> ('a -> 'b t) -> 'b t

bind o f is f v if o is Some v, None otherwise. Monadic bind.

  • since 3.0
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 f o1 o2 maps 'a option and 'b option to a 'c option using f.

val iter : ('a -> unit) -> 'a t -> unit

iter f o applies f to o. Iterate on 0 or 1 element.

val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a

fold f init o is f init x if o is Some x, or init if o is None. Fold on 0 or 1 element.

val filter : ('a -> bool) -> 'a t -> 'a t

filter f o returns Some x if o is Some x and f x is true, or None if f x is false or if o is None. Filter on 0 or 1 element.

  • since 0.5
val if_ : ('a -> bool) -> 'a -> 'a option

if_ f x is Some x if f x, None otherwise.

  • since 0.17
val exists : ('a -> bool) -> 'a t -> bool

exists f o returns true iff there exists an element for which the provided function f evaluates to true.

  • since 0.17
val for_all : ('a -> bool) -> 'a t -> bool

for_all f o returns true iff the provided function f evaluates to true for all elements.

  • since 0.17
val get_or : default:'a -> 'a t -> 'a

get_or ~default o extracts the value from o, or returns default if o is None.

  • since 0.18
val value : 'a t -> default:'a -> 'a

value o ~default is similar to the Stdlib's Option.value and to get_or.

  • since 2.8
val get_exn : 'a t -> 'a

get_exn o returns x if o is Some x or fails if o is None.

  • raises Invalid_argument

    if the option is None.

val get_exn_or : string -> 'a t -> 'a

get_exn_or msg o returns x if o is Some x or fails with Invalid_argument msg if o is None.

  • raises Invalid_argument

    if the option is None.

  • since 3.4
val get_lazy : (unit -> 'a) -> 'a t -> 'a

get_lazy default_fn o unwraps o, but if o is None it returns default_fn () instead.

  • since 0.6.1
val sequence_l : 'a t list -> 'a list t

sequence_l [x1; x2; …; xn] returns Some [y1; y2; …; yn] if every xi is Some yi. Otherwise, if the list contains at least one None, the result is None.

val wrap : ?handler:(exn -> bool) -> ('a -> 'b) -> 'a -> 'b option

wrap ?handler f x calls f x and returns Some y if f x = y. If f x raises any exception, the result is None. This can be useful to wrap functions such as Map.S.find.

  • parameter handler

    the exception handler, which returns true if the exception is to be caught.

val wrap2 : ?handler:(exn -> bool) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c option

wrap2 ?handler f x y is similar to wrap but for binary functions.

Applicative

val pure : 'a -> 'a t

pure x is an alias to return.

Alternatives

val or_ : else_:'a t -> 'a t -> 'a t

or_ ~else_ o is o if o is Some _, else_ if o is None.

  • since 1.2
val or_lazy : else_:(unit -> 'a t) -> 'a t -> 'a t

or_lazy ~else_ o is o if o is Some _, else_ () if o is None.

  • since 1.2
val choice : 'a t list -> 'a t

choice lo returns the first non-None element of the list lo, or None.

val flatten : 'a t t -> 'a t

flatten oo transforms Some x into x.

  • since 2.2
val return_if : bool -> 'a -> 'a t

return_if b x applies Some or None depending on the boolean b. More precisely, return_if false x is None, and return_if true x is Some x.

  • since 2.2

Infix Operators

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Conversion and IO

val to_list : 'a t -> 'a list

to_list o returns [x] if o is Some x or the empty list [] if o is None.

val of_list : 'a list -> 'a t

of_list l returns Some x (x being the head of the list l), or None if l is the empty list.

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

to_result e o returns Ok x if o is Some x, or Error e if o is None.

  • since 1.2
val to_result_lazy : (unit -> 'e) -> 'a t -> ('a, 'e) result

to_result_lazy f o returns Ok x if o is Some x or Error f if o is None.

  • since 1.2
val of_result : ('a, _) result -> 'a t

of_result result returns an option from a result.

  • since 1.2
type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val random : 'a random_gen -> 'a t random_gen
val choice_iter : 'a t iter -> 'a t

choice_iter iter is similar to choice, but works on iter. It returns the first Some x occurring in iter, or None otherwise.

  • since 3.0
val choice_seq : 'a t Stdlib.Seq.t -> 'a t

choice_seq seq works on Seq.t. It returns the first Some x occurring in seq, or None otherwise.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen o is o as a gen. Some x is the singleton gen containing x and None is the empty gen.

val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq o is o as a sequence Seq.t. Some x is the singleton sequence containing x and None is the empty sequence. Same as Stdlib.Option.to_seq Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter : 'a t -> 'a iter

to_iter o returns an internal iterator, like in the library Iter.

  • since 2.8
val pp : 'a printer -> 'a t printer

pp ppf o pretty-prints option o using ppf.

\ No newline at end of file +CCOption (containers.CCOption)

Module CCOption

Basic operations on the option type.

This module replaces `CCOpt`.

type +'a t = 'a option
val map : ('a -> 'b) -> 'a t -> 'b t

map f o applies the function f to the element inside o, if any.

val map_or : default:'b -> ('a -> 'b) -> 'a t -> 'b

map_or ~default f o is f x if o = Some x, default otherwise.

  • since 0.16
val map_lazy : (unit -> 'b) -> ('a -> 'b) -> 'a t -> 'b

map_lazy default_fn f o is f x if o = Some x, default_fn () otherwise.

  • since 1.2
val is_some : _ t -> bool

is_some (Some x) returns true otherwise it returns false.

val is_none : _ t -> bool

is_none None returns true otherwise it returns false.

  • since 0.11
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

compare comp o1 o2 compares two options o1 and o2, using custom comparators comp for the value. None is always assumed to be less than Some _.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal p o1 o2 tests for equality between option types o1 and o2, using a custom equality predicate p.

val return : 'a -> 'a t

return x is a monadic return, that is return x = Some x.

val some : 'a -> 'a t

Alias to return.

  • since 3.5
val none : 'a t

Alias to None.

  • since 3.5
val flat_map : ('a -> 'b t) -> 'a t -> 'b t

flat_map f o is equivalent to map followed by flatten. Flip version of (>>=).

val flat_map_l : ('a -> 'b list) -> 'a t -> 'b list

flat_map_l f o is [] if o is None, or f x if o is Some x.

  • since 3.12
val bind : 'a t -> ('a -> 'b t) -> 'b t

bind o f is f v if o is Some v, None otherwise. Monadic bind.

  • since 3.0
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map2 f o1 o2 maps 'a option and 'b option to a 'c option using f.

val iter : ('a -> unit) -> 'a t -> unit

iter f o applies f to o. Iterate on 0 or 1 element.

val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a

fold f init o is f init x if o is Some x, or init if o is None. Fold on 0 or 1 element.

val filter : ('a -> bool) -> 'a t -> 'a t

filter f o returns Some x if o is Some x and f x is true, or None if f x is false or if o is None. Filter on 0 or 1 element.

  • since 0.5
val if_ : ('a -> bool) -> 'a -> 'a option

if_ f x is Some x if f x, None otherwise.

  • since 0.17
val exists : ('a -> bool) -> 'a t -> bool

exists f o returns true iff there exists an element for which the provided function f evaluates to true.

  • since 0.17
val for_all : ('a -> bool) -> 'a t -> bool

for_all f o returns true iff the provided function f evaluates to true for all elements.

  • since 0.17
val get_or : default:'a -> 'a t -> 'a

get_or ~default o extracts the value from o, or returns default if o is None.

  • since 0.18
val value : 'a t -> default:'a -> 'a

value o ~default is similar to the Stdlib's Option.value and to get_or.

  • since 2.8
val get_exn : 'a t -> 'a

get_exn o returns x if o is Some x or fails if o is None.

  • raises Invalid_argument

    if the option is None.

val get_exn_or : string -> 'a t -> 'a

get_exn_or msg o returns x if o is Some x or fails with Invalid_argument msg if o is None.

  • raises Invalid_argument

    if the option is None.

  • since 3.4
val get_lazy : (unit -> 'a) -> 'a t -> 'a

get_lazy default_fn o unwraps o, but if o is None it returns default_fn () instead.

  • since 0.6.1
val sequence_l : 'a t list -> 'a list t

sequence_l [x1; x2; …; xn] returns Some [y1; y2; …; yn] if every xi is Some yi. Otherwise, if the list contains at least one None, the result is None.

val wrap : ?handler:(exn -> bool) -> ('a -> 'b) -> 'a -> 'b option

wrap ?handler f x calls f x and returns Some y if f x = y. If f x raises any exception, the result is None. This can be useful to wrap functions such as Map.S.find.

  • parameter handler

    the exception handler, which returns true if the exception is to be caught.

val wrap2 : ?handler:(exn -> bool) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c option

wrap2 ?handler f x y is similar to wrap but for binary functions.

Applicative

val pure : 'a -> 'a t

pure x is an alias to return.

Alternatives

val or_ : else_:'a t -> 'a t -> 'a t

or_ ~else_ o is o if o is Some _, else_ if o is None.

  • since 1.2
val or_lazy : else_:(unit -> 'a t) -> 'a t -> 'a t

or_lazy ~else_ o is o if o is Some _, else_ () if o is None.

  • since 1.2
val choice : 'a t list -> 'a t

choice lo returns the first non-None element of the list lo, or None.

val flatten : 'a t t -> 'a t

flatten oo transforms Some x into x.

  • since 2.2
val return_if : bool -> 'a -> 'a t

return_if b x applies Some or None depending on the boolean b. More precisely, return_if false x is None, and return_if true x is Some x.

  • since 2.2

Infix Operators

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ('a -> 'b) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Conversion and IO

val to_list : 'a t -> 'a list

to_list o returns [x] if o is Some x or the empty list [] if o is None.

val of_list : 'a list -> 'a t

of_list l returns Some x (x being the head of the list l), or None if l is the empty list.

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

to_result e o returns Ok x if o is Some x, or Error e if o is None.

  • since 1.2
val to_result_lazy : (unit -> 'e) -> 'a t -> ('a, 'e) result

to_result_lazy f o returns Ok x if o is Some x or Error f if o is None.

  • since 1.2
val of_result : ('a, _) result -> 'a t

of_result result returns an option from a result.

  • since 1.2
type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val random : 'a random_gen -> 'a t random_gen
val choice_iter : 'a t iter -> 'a t

choice_iter iter is similar to choice, but works on iter. It returns the first Some x occurring in iter, or None otherwise.

  • since 3.0
val choice_seq : 'a t Stdlib.Seq.t -> 'a t

choice_seq seq works on Seq.t. It returns the first Some x occurring in seq, or None otherwise.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen o is o as a gen. Some x is the singleton gen containing x and None is the empty gen.

val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq o is o as a sequence Seq.t. Some x is the singleton sequence containing x and None is the empty sequence. Same as Stdlib.Option.to_seq Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter : 'a t -> 'a iter

to_iter o returns an internal iterator, like in the library Iter.

  • since 2.8
val pp : 'a printer -> 'a t printer

pp ppf o pretty-prints option o using ppf.

\ No newline at end of file diff --git a/dev/containers/CCParse/Infix/index.html b/dev/containers/CCParse/Infix/index.html index 23a12589..586bf834 100644 --- a/dev/containers/CCParse/Infix/index.html +++ b/dev/containers/CCParse/Infix/index.html @@ -1,2 +1,2 @@ -Infix (containers.CCParse.Infix)

Module CCParse.Infix

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Alias to map. p >|= f parses an item x using p, and returns f x.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Alias to bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The result of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

Alias to or_.

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a.

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails, a <?> msg fails with msg instead. Useful as the last choice in a series of <|>. For example: a <|> b <|> c <?> "expected one of a, b, c".

val (|||) : 'a t -> 'b t -> ('a * 'b) t

Alias to both. a ||| b parses a, then b, then returns the pair of their results.

  • since 3.6

Let operators on OCaml >= 4.08.0, nothing otherwise

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file +Infix (containers.CCParse.Infix)

Module CCParse.Infix

val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Alias to map. p >|= f parses an item x using p, and returns f x.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Alias to bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The result of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

Alias to or_.

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a.

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails, a <?> msg fails with msg instead. Useful as the last choice in a series of <|>. For example: a <|> b <|> c <?> "expected one of a, b, c".

val (|||) : 'a t -> 'b t -> ('a * 'b) t

Alias to both. a ||| b parses a, then b, then returns the pair of their results.

  • since 3.6
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/CCParse/index.html b/dev/containers/CCParse/index.html index e04503f2..305f0651 100644 --- a/dev/containers/CCParse/index.html +++ b/dev/containers/CCParse/index.html @@ -45,4 +45,4 @@ assert (l=l');;

'acc -> ('acc * string) t

Same as chars_fold but with the following differences:

val take_until_success : 'a t -> (slice * 'a) t

take_until_success p accumulates characters of the input into a slice, until p successfully parses a value x; then it returns slice, x.

NOTE performance wise, if p does a lot of work at each position, this can be costly (thing naive substring search if p is string "very long needle").

  • since 3.12
val take : int -> slice t

take len parses exactly len characters from the input. Fails if the input doesn't contain at least len chars.

  • since 3.6
val take_if : (char -> bool) -> slice t

take_if f takes characters as long as they satisfy the predicate f.

  • since 3.6
val take1_if : ?descr:string -> (char -> bool) -> slice t

take1_if f takes characters as long as they satisfy the predicate f. Fails if no character satisfies f.

  • parameter descr

    describes what kind of character was expected, in case of error

  • since 3.6
val char_if : ?descr:string -> (char -> bool) -> char t

char_if f parses a character c if f c = true. Fails if the next char does not satisfy f.

  • parameter descr

    describes what kind of character was expected, in case of error

val chars_if : (char -> bool) -> string t

chars_if f parses a string of chars that satisfy f. Cannot fail.

val chars1_if : ?descr:string -> (char -> bool) -> string t

Like chars_if, but accepts only non-empty strings. chars1_if p fails if the string accepted by chars_if p is empty. chars1_if p is equivalent to take1_if p >|= Slice.to_string.

  • parameter descr

    describes what kind of character was expected, in case of error

val endline : char t

Parse '\n'.

val space : char t

Tab or space.

val white : char t

Tab or space or newline.

val skip_chars : (char -> bool) -> unit t

Skip 0 or more chars satisfying the predicate.

val skip_space : unit t

Skip ' ' and '\t'.

val skip_white : unit t

Skip ' ' and '\t' and '\n'.

val is_alpha : char -> bool

Is the char a letter?

val is_num : char -> bool

Is the char a digit?

val is_alpha_num : char -> bool

Is the char a letter or a digit?

val is_space : char -> bool

True on ' ' and '\t'.

val is_white : char -> bool

True on ' ' and '\t' and '\n'.

val suspend : (unit -> 'a t) -> 'a t

suspend f is the same as f (), but evaluates f () only when needed.

A practical use case is to implement recursive parsers manually, as described in fix. The parser is let rec p () = …, and suspend p can be used in the definition to use p.

val string : string -> string t

string s parses exactly the string s, and nothing else.

val exact : string -> string t

Alias to string.

  • since 3.6
val many : 'a t -> 'a list t

many p parses p repeatedly, until p fails, and collects the results into a list.

val optional : _ t -> unit t

optional p tries to parse p, and return () whether it succeeded or failed. Cannot fail itself. It consumes input if p succeeded (as much as p consumed), but consumes not input if p failed.

  • since 3.6
val try_ : 'a t -> 'a t

try_ p is just like p (it used to play a role in backtracking semantics but no more).

  • deprecated

    since 3.6 it can just be removed. See try_opt if you want to detect failure.

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

try_opt p tries to parse using p, and return Some x if p succeeded with x (and consumes what p consumed). Otherwise it returns None and consumes nothing. This cannot fail.

  • since 3.6
val many_until : until:_ t -> 'a t -> 'a list t

many_until ~until p parses as many p as it can until the until parser successfully returns. If p fails before that then many_until ~until p fails as well. Typically until can be a closing ')' or another termination condition, and what is consumed by until is also consumed by many_until ~until p.

EXPERIMENTAL

  • since 3.6
val try_or : 'a t -> f:('a -> 'b t) -> else_:'b t -> 'b t

try_or p1 ~f ~else_:p2 attempts to parse x using p1, and then becomes f x. If p1 fails, then it becomes p2. This can be useful if f is expensive but only ever works if p1 matches (e.g. after an opening parenthesis or some sort of prefix).

  • since 3.6
val try_or_l : ?msg:string -> ?else_:'a t -> (unit t * 'a t) list -> 'a t

try_or_l ?else_ l tries each pair (test, p) in order. If the n-th test succeeds, then try_or_l l behaves like n-th p, whether p fails or not. If test consumes input, the state is restored before calling p. If they all fail, and else_ is defined, then it behaves like else_. If all fail, and else_ is None, then it fails as well.

This is a performance optimization compared to (<|>). We commit to a branch if the test succeeds, without backtracking at all. It can also provide better error messages, because failures in the parser will not be reported as failures in try_or_l.

See lookahead_ignore for a convenient way of writing the test conditions.

  • parameter msg

    error message if all options fail

    EXPERIMENTAL

  • since 3.6
val or_ : 'a t -> 'a t -> 'a t

or_ p1 p2 tries to parse p1, and if it fails, tries p2 from the same position.

  • since 3.6
val both : 'a t -> 'b t -> ('a * 'b) t

both a b parses a, then b, then returns the pair of their results.

  • since 3.6
val many1 : 'a t -> 'a list t

many1 p is like many p excepts it fails if the list is empty (i.e. it needs p to succeed at least once).

val skip : _ t -> unit t

skip p parses zero or more times p and ignores its result. It is eager, meaning it will continue as long as p succeeds. As soon as p fails, skip p stops consuming any input.

val sep : by:_ t -> 'a t -> 'a list t

sep ~by p parses a list of p separated by by.

val sep_until : until:_ t -> by:_ t -> 'a t -> 'a list t

Same as sep but stop when until parses successfully.

  • since 3.6
val sep1 : by:_ t -> 'a t -> 'a list t

sep1 ~by p parses a non empty list of p, separated by by.

val lookahead : 'a t -> 'a t

lookahead p behaves like p, except it doesn't consume any input.

EXPERIMENTAL

  • since 3.6
val lookahead_ignore : 'a t -> unit t

lookahead_ignore p tries to parse input with p, and succeeds if p succeeds. However it doesn't consume any input and returns (), so in effect its only use-case is to detect whether p succeeds, e.g. in try_or_l.

EXPERIMENTAL

  • since 3.6
val fix : ('a t -> 'a t) -> 'a t

Fixpoint combinator. fix (fun self -> p) is the parser p, in which self refers to the parser p itself (which is useful to parse recursive structures.

An alternative, manual implementation to let p = fix (fun self -> q) is:

let rec p () =
  let self = suspend p in
- q
val line : slice t

Parse a line, '\n' excluded, and position the cursor after the '\n'.

  • since 3.6
val line_str : string t

line_str is line >|= Slice.to_string. It parses the next line and turns the slice into a string. The state points to the character immediately after the '\n' character.

  • since 3.6
val each_line : 'a t -> 'a list t

each_line p runs p on each line of the input. EXPERIMENTAL

  • since 3.6
val split_1 : on_char:char -> (slice * slice option) t

split_1 ~on_char looks for on_char in the input, and returns a pair sl1, sl2, where:

  • sl1 is the slice of the input the precedes the first occurrence of on_char, or the whole input if on_char cannot be found. It does not contain on_char.
  • sl2 is the slice that comes after on_char, or None if on_char couldn't be found. It doesn't contain the first occurrence of on_char (if any).

The parser is now positioned at the end of the input.

EXPERIMENTAL

  • since 3.6
val split_list : on_char:char -> slice list t

split_list ~on_char splits the input on all occurrences of on_char, returning a list of slices.

EXPERIMENTAL

  • since 3.6
val split_list_at_most : on_char:char -> int -> slice list t

split_list_at_most ~on_char n applies split_1 ~on_char at most n times, to get a list of n+1 elements. The last element might contain on_char. This is useful to limit the amount of work done by split_list.

EXPERIMENTAL

  • since 3.6
val split_2 : on_char:char -> (slice * slice) t

split_2 ~on_char splits the input into exactly 2 fields, and fails if the split yields less or more than 2 items. EXPERIMENTAL

  • since 3.6
val split_3 : on_char:char -> (slice * slice * slice) t

See split_2 EXPERIMENTAL

  • since 3.6
val split_4 : on_char:char -> (slice * slice * slice * slice) t

See split_2 EXPERIMENTAL

  • since 3.6
val each_split : on_char:char -> 'a t -> 'a list t

split_list_map ~on_char p uses split_list ~on_char to split the input, then parses each chunk of the input thus obtained using p.

The difference with sep ~by:(char on_char) p is that sep calls p first, and only tries to find on_char after p returns. While it is more flexible, this technique also means p has to be careful not to consume on_char by error.

A useful specialization of this is each_line, which is basically each_split ~on_char:'\n' p.

EXPERIMENTAL

  • since 3.6
val all : slice t

all returns all the unconsumed input as a slice, and consumes it. Use Slice.to_string to turn it into a string.

Note that lookahead all can be used to peek at the rest of the input without consuming anything.

  • since 3.6
val all_str : string t

all_str accepts all the remaining chars and extracts them into a string. Similar to all but with a string.

EXPERIMENTAL

  • since 3.6
val memo : 'a t -> 'a t

Memoize the parser. memo p will behave like p, but when called in a state (read: position in input) it has already processed, memo p returns a result directly. The implementation uses an underlying hashtable. This can be costly in memory, but improve the run time a lot if there is a lot of backtracking involving p.

Do not call memo inside other functions, especially with (>>=), map, etc. being so prevalent. Instead the correct way to use it is in a toplevel definition:

let my_expensive_parser = memo (foo *> bar >>= fun i -> …)

This function is not thread-safe.

val fix_memo : ('a t -> 'a t) -> 'a t

Like fix, but the fixpoint is memoized.

Infix

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Alias to map. p >|= f parses an item x using p, and returns f x.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Alias to bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The result of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

Alias to or_.

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a.

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails, a <?> msg fails with msg instead. Useful as the last choice in a series of <|>. For example: a <|> b <|> c <?> "expected one of a, b, c".

val (|||) : 'a t -> 'b t -> ('a * 'b) t

Alias to both. a ||| b parses a, then b, then returns the pair of their results.

  • since 3.6

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Parse input

val stringify_result : 'a or_error -> ('a, string) result

Turn a Error.t-oriented result into a more basic string result.

val parse_string : 'a t -> string -> ('a, string) result

Parse a string using the parser.

val parse_string_e : 'a t -> string -> 'a or_error

Version of parse_string that returns a more detailed error.

val parse_string_exn : 'a t -> string -> 'a
val parse_file : 'a t -> string -> ('a, string) result

parse_file p filename parses file named filename with p by opening the file and reading it whole.

val parse_file_e : 'a t -> string -> 'a or_error

Version of parse_file that returns a more detailed error.

val parse_file_exn : 'a t -> string -> 'a

Same as parse_file, but

module U : sig ... end
module Debug_ : sig ... end

Debugging utils. EXPERIMENTAL

\ No newline at end of file + q
val line : slice t

Parse a line, '\n' excluded, and position the cursor after the '\n'.

val line_str : string t

line_str is line >|= Slice.to_string. It parses the next line and turns the slice into a string. The state points to the character immediately after the '\n' character.

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

each_line p runs p on each line of the input. EXPERIMENTAL

val split_1 : on_char:char -> (slice * slice option) t

split_1 ~on_char looks for on_char in the input, and returns a pair sl1, sl2, where:

The parser is now positioned at the end of the input.

EXPERIMENTAL

val split_list : on_char:char -> slice list t

split_list ~on_char splits the input on all occurrences of on_char, returning a list of slices.

EXPERIMENTAL

val split_list_at_most : on_char:char -> int -> slice list t

split_list_at_most ~on_char n applies split_1 ~on_char at most n times, to get a list of n+1 elements. The last element might contain on_char. This is useful to limit the amount of work done by split_list.

EXPERIMENTAL

val split_2 : on_char:char -> (slice * slice) t

split_2 ~on_char splits the input into exactly 2 fields, and fails if the split yields less or more than 2 items. EXPERIMENTAL

val split_3 : on_char:char -> (slice * slice * slice) t

See split_2 EXPERIMENTAL

val split_4 : on_char:char -> (slice * slice * slice * slice) t

See split_2 EXPERIMENTAL

val each_split : on_char:char -> 'a t -> 'a list t

split_list_map ~on_char p uses split_list ~on_char to split the input, then parses each chunk of the input thus obtained using p.

The difference with sep ~by:(char on_char) p is that sep calls p first, and only tries to find on_char after p returns. While it is more flexible, this technique also means p has to be careful not to consume on_char by error.

A useful specialization of this is each_line, which is basically each_split ~on_char:'\n' p.

EXPERIMENTAL

val all : slice t

all returns all the unconsumed input as a slice, and consumes it. Use Slice.to_string to turn it into a string.

Note that lookahead all can be used to peek at the rest of the input without consuming anything.

val all_str : string t

all_str accepts all the remaining chars and extracts them into a string. Similar to all but with a string.

EXPERIMENTAL

val memo : 'a t -> 'a t

Memoize the parser. memo p will behave like p, but when called in a state (read: position in input) it has already processed, memo p returns a result directly. The implementation uses an underlying hashtable. This can be costly in memory, but improve the run time a lot if there is a lot of backtracking involving p.

Do not call memo inside other functions, especially with (>>=), map, etc. being so prevalent. Instead the correct way to use it is in a toplevel definition:

let my_expensive_parser = memo (foo *> bar >>= fun i -> …)

This function is not thread-safe.

val fix_memo : ('a t -> 'a t) -> 'a t

Like fix, but the fixpoint is memoized.

Infix

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Alias to map. p >|= f parses an item x using p, and returns f x.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Alias to bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The result of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

Alias to or_.

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a.

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails, a <?> msg fails with msg instead. Useful as the last choice in a series of <|>. For example: a <|> b <|> c <?> "expected one of a, b, c".

val (|||) : 'a t -> 'b t -> ('a * 'b) t

Alias to both. a ||| b parses a, then b, then returns the pair of their results.

  • since 3.6
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Parse input

val stringify_result : 'a or_error -> ('a, string) result

Turn a Error.t-oriented result into a more basic string result.

val parse_string : 'a t -> string -> ('a, string) result

Parse a string using the parser.

val parse_string_e : 'a t -> string -> 'a or_error

Version of parse_string that returns a more detailed error.

val parse_string_exn : 'a t -> string -> 'a
val parse_file : 'a t -> string -> ('a, string) result

parse_file p filename parses file named filename with p by opening the file and reading it whole.

val parse_file_e : 'a t -> string -> 'a or_error

Version of parse_file that returns a more detailed error.

val parse_file_exn : 'a t -> string -> 'a

Same as parse_file, but

module U : sig ... end
module Debug_ : sig ... end

Debugging utils. EXPERIMENTAL

\ No newline at end of file diff --git a/dev/containers/CCRandom/index.html b/dev/containers/CCRandom/index.html index d582cdfe..695269bc 100644 --- a/dev/containers/CCRandom/index.html +++ b/dev/containers/CCRandom/index.html @@ -14,4 +14,4 @@ delay (fun () -> ?subn:(int t * ('a list t -> 'a t)) list -> base:'a t -> int t -> - 'a t

Recursion combinators, for building recursive values. The integer generator is used to provide fuel. The sub_ generators should use their arguments only once!

Applicative
val pure : 'a -> 'a t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Let operators on OCaml >= 4.08.0, nothing otherwise

val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
Run a generator
val run : ?st:state -> 'a t -> 'a

Using a random state (possibly the one in argument) run a generator.

\ No newline at end of file + 'a t

Recursion combinators, for building recursive values. The integer generator is used to provide fuel. The sub_ generators should use their arguments only once!

Applicative
val pure : 'a -> 'a t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
Run a generator
val run : ?st:state -> 'a t -> 'a

Using a random state (possibly the one in argument) run a generator.

\ No newline at end of file diff --git a/dev/containers/CCShims_/index.html b/dev/containers/CCShims_/index.html deleted file mode 100644 index 2f5390d4..00000000 --- a/dev/containers/CCShims_/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -CCShims_ (containers.CCShims_)

Module CCShims_

module Stdlib = Stdlib
\ No newline at end of file diff --git a/dev/containers/CCShims_syntax/index.html b/dev/containers/CCShims_syntax/index.html deleted file mode 100644 index 8c9f34c9..00000000 --- a/dev/containers/CCShims_syntax/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -CCShims_syntax (containers.CCShims_syntax)

Module CCShims_syntax

module type LET = sig ... end

Let operators on OCaml >= 4.08.0, nothing otherwise

\ No newline at end of file diff --git a/dev/containers/CCShims_syntax/module-type-LET/index.html b/dev/containers/CCShims_syntax/module-type-LET/index.html deleted file mode 100644 index 0849d45b..00000000 --- a/dev/containers/CCShims_syntax/module-type-LET/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -LET (containers.CCShims_syntax.LET)

Module type CCShims_syntax.LET

Let operators on OCaml >= 4.08.0, nothing otherwise

type 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/dev/containers/Containers/index.html b/dev/containers/Containers/index.html index 27d80037..48621bd0 100644 --- a/dev/containers/Containers/index.html +++ b/dev/containers/Containers/index.html @@ -1,2 +1,2 @@ -Containers (containers.Containers)

Module Containers

Drop-In replacement to Stdlib

module Array = CCArray
module Bool = CCBool
module Byte_buffer = CCByte_buffer
module Char = CCChar
module Equal = CCEqual
module Either = CCEither
module Float = CCFloat
module Format = CCFormat
module Fun = CCFun
module Hash = CCHash
module Hashtbl : sig ... end
module Heap = CCHeap
module Int = CCInt
module Int32 = CCInt32
module Int64 = CCInt64
module IO = CCIO
module List = CCList
module Map = CCMap
module Nativeint = CCNativeint
module Option = CCOption
module Ord = CCOrd
module Pair = CCPair
module Parse = CCParse
module Random = CCRandom
module Ref = CCRef
module Result = CCResult
module Seq = CCSeq
module Set = CCSet
module String = CCString
module Vector = CCVector
module Monomorphic = CCMonomorphic
module Utf8_string = CCUtf8_string
module Unit = CCUnit
module Atomic = CCAtomic
module Sexp = CCSexp
module Sexp_intf = CCSexp_intf
module Canonical_sexp = CCCanonical_sexp
module Stdlib = CCShims_.Stdlib
include module type of struct include Monomorphic end

Shadow unsafe functions and operators from Stdlib

  • since 2.0
val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
  • deprecated Please use CCEqual.physical or Stdlib.(==) instead.
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
  • deprecated Please use [not CCEqual.physical] or Stdlib.(!=) instead.
\ No newline at end of file +Containers (containers.Containers)

Module Containers

Drop-In replacement to Stdlib

module Array = CCArray
module Bool = CCBool
module Byte_buffer = CCByte_buffer
module Char = CCChar
module Equal = CCEqual
module Either = CCEither
module Float = CCFloat
module Format = CCFormat
module Fun = CCFun
module Hash = CCHash
module Hashtbl : sig ... end
module Heap = CCHeap
module Int = CCInt
module Int32 = CCInt32
module Int64 = CCInt64
module IO = CCIO
module List = CCList
module Map = CCMap
module Nativeint = CCNativeint
module Option = CCOption
module Ord = CCOrd
module Pair = CCPair
module Parse = CCParse
module Random = CCRandom
module Ref = CCRef
module Result = CCResult
module Seq = CCSeq
module Set = CCSet
module String = CCString
module Vector = CCVector
module Monomorphic = CCMonomorphic
module Utf8_string = CCUtf8_string
module Unit = CCUnit
module Atomic = CCAtomic
module Sexp = CCSexp
module Sexp_intf = CCSexp_intf
module Canonical_sexp = CCCanonical_sexp
module Stdlib = Stdlib
include module type of struct include Monomorphic end

Shadow unsafe functions and operators from Stdlib

  • since 2.0
val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
  • deprecated Please use CCEqual.physical or Stdlib.(==) instead.
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
  • deprecated Please use [not CCEqual.physical] or Stdlib.(!=) instead.
\ No newline at end of file diff --git a/dev/containers/ContainersLabels/index.html b/dev/containers/ContainersLabels/index.html index a4100a7c..9a4bec44 100644 --- a/dev/containers/ContainersLabels/index.html +++ b/dev/containers/ContainersLabels/index.html @@ -1,2 +1,2 @@ -ContainersLabels (containers.ContainersLabels)

Module ContainersLabels

Drop-In replacement to Stdlib

module Array = CCArrayLabels
module Bool = CCBool
module Byte_buffer = CCByte_buffer
module Char = CCChar
module Equal = CCEqualLabels
module Either = CCEither
module Float = CCFloat
module Format = CCFormat
module Fun = CCFun
module Hash = CCHash
module Hashtbl : sig ... end
module Heap = CCHeap
module Int = CCInt
module Int32 = CCInt32
module Int64 = CCInt64
module IO = CCIO
module List = CCListLabels
module Map = CCMap
module Nativeint = CCNativeint
module Option = CCOption
module Ord = CCOrd
module Pair = CCPair
module Parse = CCParse
module Random = CCRandom
module Ref = CCRef
module Result = CCResult
module Seq = CCSeq
module Set = CCSet
module String = CCStringLabels
module Vector = CCVector
module Monomorphic = CCMonomorphic
module Utf8_string = CCUtf8_string
module Sexp = CCSexp
module Sexp_intf = CCSexp_intf
module Stdlib = CCShims_.Stdlib
include module type of struct include Monomorphic end

Shadow unsafe functions and operators from Stdlib

  • since 2.0
val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
  • deprecated Please use CCEqual.physical or Stdlib.(==) instead.
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
  • deprecated Please use [not CCEqual.physical] or Stdlib.(!=) instead.
\ No newline at end of file +ContainersLabels (containers.ContainersLabels)

Module ContainersLabels

Drop-In replacement to Stdlib

module Array = CCArrayLabels
module Bool = CCBool
module Byte_buffer = CCByte_buffer
module Char = CCChar
module Equal = CCEqualLabels
module Either = CCEither
module Float = CCFloat
module Format = CCFormat
module Fun = CCFun
module Hash = CCHash
module Hashtbl : sig ... end
module Heap = CCHeap
module Int = CCInt
module Int32 = CCInt32
module Int64 = CCInt64
module IO = CCIO
module List = CCListLabels
module Map = CCMap
module Nativeint = CCNativeint
module Option = CCOption
module Ord = CCOrd
module Pair = CCPair
module Parse = CCParse
module Random = CCRandom
module Ref = CCRef
module Result = CCResult
module Seq = CCSeq
module Set = CCSet
module String = CCStringLabels
module Vector = CCVector
module Monomorphic = CCMonomorphic
module Utf8_string = CCUtf8_string
module Sexp = CCSexp
module Sexp_intf = CCSexp_intf
module Stdlib = Stdlib
include module type of struct include Monomorphic end

Shadow unsafe functions and operators from Stdlib

  • since 2.0
val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
  • deprecated Please use CCEqual.physical or Stdlib.(==) instead.
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
  • deprecated Please use [not CCEqual.physical] or Stdlib.(!=) instead.
\ No newline at end of file diff --git a/dev/containers/Containers_cbor/index.html b/dev/containers/Containers_cbor/index.html index 5c64be32..933fac87 100644 --- a/dev/containers/Containers_cbor/index.html +++ b/dev/containers/Containers_cbor/index.html @@ -1,2 +1,2 @@ -Containers_cbor (containers.Containers_cbor)

Module Containers_cbor

CBOR encoder/decoder.

The type is chosen to be compatible with ocaml-cbor. See the RFC.

note this is experimental.

note this is only available on OCaml >= 4.08. Below that, the module is empty.

type t = [
  1. | `Null
  2. | `Undefined
  3. | `Simple of int
  4. | `Bool of bool
  5. | `Int of int64
  6. | `Float of float
  7. | `Bytes of string
  8. | `Text of string
  9. | `Array of t list
  10. | `Map of (t * t) list
  11. | `Tag of int * t
]
val pp_diagnostic : t CCFormat.printer
val to_string_diagnostic : t -> string
val encode : ?buf:Stdlib.Buffer.t -> t -> string
val decode : string -> (t, string) result
val decode_exn : string -> t

Like decode.

  • raises Failure

    if the string isn't valid

\ No newline at end of file +Containers_cbor (containers.Containers_cbor)

Module Containers_cbor

CBOR encoder/decoder.

The type is chosen to be compatible with ocaml-cbor. See the RFC.

note this is experimental.

type t = [
  1. | `Null
  2. | `Undefined
  3. | `Simple of int
  4. | `Bool of bool
  5. | `Int of int64
  6. | `Float of float
  7. | `Bytes of string
  8. | `Text of string
  9. | `Array of t list
  10. | `Map of (t * t) list
  11. | `Tag of int * t
]
val pp_diagnostic : t CCFormat.printer
val to_string_diagnostic : t -> string
val encode : ?buf:Stdlib.Buffer.t -> t -> string
val decode : string -> (t, string) result
val decode_exn : string -> t

Like decode.

  • raises Failure

    if the string isn't valid

\ No newline at end of file diff --git a/dev/containers/index.html b/dev/containers/index.html index d8edf060..1d566409 100644 --- a/dev/containers/index.html +++ b/dev/containers/index.html @@ -1,2 +1,2 @@ -index (containers.index)

Package containers

Package info

changes-files
license-files
readme-files
\ No newline at end of file +index (containers.index)

Package containers

Package info

changes-files
license-files
readme-files
\ No newline at end of file