Module GendarmeSource

This module provides the Gendarme library

Sourceexception Unimplemented_case

Generic failover exception when handling unhandled type extensions

Sourceexception Unknown_field

Exception raised when unmarshalling unknown record fields or variant cases

Sourceexception Type_error

Exception raised when unmarshalling data to the wrong type

Sourceexception Unpack_error

Exception raised when unpacking values from a different encoder. This should not be raised under normal circumstances.

Sourcetype _ t = ..

Extensible GADT wrapping OCaml types

Sourcetype target = ..

Extensible type to register new encoding targets

Sourcetype encoder = ..

Extensible type to register new encoders

Sourcetype 'a ty = unit -> 'a t

Convenience type

Sourcemodule type M = sig ... end

Minimal encoder signature

Sourcemodule type S = sig ... end

Encoder signature

Sourcetype 'a o_lens = {
  1. o_fds : (encoder * string) list;
  2. o_get : 'a -> (encoder * string) -> target;
  3. o_put : 'a -> (encoder * string) -> target -> 'a;
  4. o_def : 'a;
}

Record marshalling lens type

Sourcetype 'a a_lens = {
  1. a_get : (module M) -> 'a -> target;
  2. a_put : (module M) -> target -> 'a;
}

Variant marshalling lens type

Sourcetype t +=
  1. | Int : int t
  2. | Float : float t
  3. | String : string t
  4. | List : 'a ty -> 'a list t
  5. | Option : 'a ty -> 'a option t
  6. | Empty_list : string list t
  7. | Tuple2 : 'a ty * 'b ty -> ('a * 'b) t
  8. | Tuple3 : 'a ty * 'b ty * 'c ty -> ('a * 'b * 'c) t
  9. | Tuple4 : 'a ty * 'b ty * 'c ty * 'd ty -> ('a * 'b * 'c * 'd) t
  10. | Tuple5 : 'a ty * 'b ty * 'c ty * 'd ty * 'e ty -> ('a * 'b * 'c * 'd * 'e) t
  11. | Object : 'a o_lens -> 'a t
  12. | Alt : 'a a_lens -> 'a t

Extension of t to usual OCaml types

Sourceval default : 'a ty -> unit -> 'a

Get the default value for the given type

Sourceval get : ?v:'a -> 'a ty -> 'a

Get the given value or the default one for the given type

Sourceval assoc : encoder -> ?v:'a -> 'a o_lens -> (string * target) list

Helper function to simplify marshalling records

Sourceval deassoc : encoder -> 'a o_lens -> (string * target) list -> 'a

Helper function to simplify unmarshalling records

Sourceval int : unit -> int t

int witness

Sourceval float : unit -> float t

float witness

Sourceval string : unit -> string t

string witness

Sourceval list : 'a ty -> unit -> 'a list t

'a list witness builder

Sourceval option : 'a ty -> unit -> 'a option t

'a option witness builder

Sourceval empty_list : unit -> string list t

Empty 'a list witness

Sourceval tuple2 : 'a ty -> 'b ty -> unit -> ('a * 'b) t

('a * 'b) witness builder

Sourceval pair : 'a ty -> 'b ty -> unit -> ('a * 'b) t

Alias for tuple2

Sourceval double : 'a ty -> 'b ty -> unit -> ('a * 'b) t

Alias for tuple2

Sourceval couple : 'a ty -> 'b ty -> unit -> ('a * 'b) t

Alias for tuple2

Sourceval tuple3 : 'a ty -> 'b ty -> 'c ty -> unit -> ('a * 'b * 'c) t

('a * 'b * 'c) witness builder

Sourceval triple : 'a ty -> 'b ty -> 'c ty -> unit -> ('a * 'b * 'c) t

Alias for tuple3

Sourceval tuple4 : 'a ty -> 'b ty -> 'c ty -> 'd ty -> unit -> ('a * 'b * 'c * 'd) t

('a * 'b * 'c * 'd) witness builder

Sourceval quadruple : 'a ty -> 'b ty -> 'c ty -> 'd ty -> unit -> ('a * 'b * 'c * 'd) t

Alias for tuple4

Sourceval tuple5 : 'a ty -> 'b ty -> 'c ty -> 'd ty -> 'e ty -> unit -> ('a * 'b * 'c * 'd * 'e) t

('a * 'b * 'c * 'd * 'e) witness builder

Sourceval quintuple : 'a ty -> 'b ty -> 'c ty -> 'd ty -> 'e ty -> unit -> ('a * 'b * 'c * 'd * 'e) t

Alias for tuple5