Module Descr


module Descr: sig .. end
Type description for safer unmarshalling.

This module provides a safer API than the library "unmarshal" for registering type description.



Type declaration


type 'a t 
Type of a type description. The type variable is for safety only.
type packed 
Type of an "embeded" type description (that is a type description enclosed into one other).

Smart constructors


val pack : 'a t -> packed
Create an embeded type description from a standard type description.
val abstract : 'a Type.t -> 'a t
Similar to the Unmarshal.Abstract constructor.
val sum : 'a Type.t -> packed array array -> 'a t
Similar to the Unmarshal.Sum constructor.
val dependent_pair : 'a Type.t -> 'b t -> ('b -> 'a t) -> ('b * 'a) t
Similar to the Unmarshal.Dependent_pair constructor.
val array : 'a Type.t -> packed -> 'a t
Similar to the Unmarshal.Array constructor.
val transform : 'a t -> ('a -> 'a) -> 'a t
Similar to the Unmarshal.Transform constructor with sanity check.
val return : 'a t -> (unit -> 'a) -> 'a t
Similar to the Unmarshal.Return constructor with sanity check.
val dynamic : 'a Type.t -> (unit -> 'a t) -> 'a t
Similar to the Unmarshal.Dynamic constructor.

Predefined type description values


val t_int : int t
val t_string : string t
val t_float : float t
val t_bool : bool t
val t_int32 : int32 t
val t_int64 : int64 t
val t_nativeint : nativeint t

Convenient functions for building type description


val t_record : 'a Type.t -> packed array -> 'a t
val t_tuple : 'a Type.t -> packed array -> 'a t
val t_couple : 'a t -> 'b t -> ('a * 'b) t
val t_list : 'a t -> 'a list t
val t_ref : 'a t -> 'a Pervasives.ref t
val t_option : 'a t -> 'a option t
val t_hashtbl_unchangedhashs : 'a t -> 'b t -> ('a, 'b) Hashtbl.t t
val t_hashtbl_changedhashs : (int -> ('a, 'b) Hashtbl.t) ->
(('a, 'b) Hashtbl.t -> 'a -> 'b -> unit) ->
'a t -> 'b t -> ('a, 'b) Hashtbl.t t