Page
Library
Module
Module type
Parameter
Class
Class type
Source
Typeval verbose : int reftype compo_type = | Name of string * compo_type listdenote a type expr with arguments i.e. 'a list
| Abstract of stringdenote a polymorphic type i.e. 'a
| Fun of compo_type list * compo_typedenote a function i.e. 'a -> 'b
| Prod of compo_type listdenote a tupe i.e. 'a * 'b * ... 'z
A type for ocaml type
A type for named function
val flatten_prod : compo_type list -> compo_type listval ano_func : func -> compo_typeval deano_func : string -> compo_type -> funcval instantiate_named :
string ->
string list ->
compo_type ->
compo_type ->
compo_typeinstantiate_named name args concete_named vtype Instantiate vtype by replacing abstract type in the args list by its types given as a named type. Example with int option : instantiate_named "option" ["a"] (Name ("option",[Name ("int",[])])) (Abstract "a") returns Name ("int",[])
type sum_type_def = (string * compo_type option * float option) listtype def_type_elem = | Sum of sum_type_def| Alias of compo_type| Record of (string * compo_type) listtype def_type = string * string list * def_type_elemdefine a named type with name, list of argument and definition
Poor man dynamic typing. See hide and reveal for mor detail. Usefull for value generation at runtime.
val hide : 'a -> compo_type -> hidden_typeHide a value inside hidden_type the value could be only read by reveal the compo_type serve as a guard to ensure type corectess. reveal assert that the two types matches. for a compo_type t the composition reveal (hide x t) t act like Obj.magic x use with caution.
val reveal : hidden_type -> compo_type -> 'aSee hide
type recdefprint = (compo_type * string) listtype poly = ((compo_type list * int) * float) listtype poly_assoc = (compo_type * poly) listtype equ_gen_type = compo_type -> poly_assoc -> poly_assoctype printer_type = compo_type -> Format.formatter -> hidden_type -> unittype gen_to_string = recdefprint -> compo_type -> stringtype value_generator =
Random.State.t ->
int ->
compo_type ->
float ->
hidden_type * intType for a value generator given a random generator state a maximal value, a type t a boltzmann parameter, generate a hidden OCaml value and its size of type t
type boltzmann_generator = compo_type -> gen_functiontype named_type = {identifier : string;Name of the type as OCaml name it
*)boltz_identifier : string;Name of the type as Boltzgen name it for example nat instead of int for natural number
*)is_simple : bool;is define recursively
*)arguments : int;Number of arguments
*)get_equ : equ_gen_type -> equ_gen_type;Return the set of equations require for boltzmann sampling
*)gen_fun : value_generator -> boltzmann_generator -> value_generator;Generate a hidden OCaml value and its size from a type
*)print : printer_type -> printer_type;Given a hidden value, print it on the formatter
*)string_of_named : gen_to_string -> gen_to_string;Print the printing function for this type
*)boltzman_fun : boltzmann_generator -> boltzmann_generator;Compute the boltzmann generating function
*)}Datastructure for sampler of named type
val find_type : string -> named_typeval add_type_to_lib : ?rename:string -> named_type -> unitval pp_compo : ?use_boltz_id:bool -> Format.formatter -> compo_type -> unitval pp_type_of_out : Format.formatter -> compo_type -> unitval pp_func :
?use_boltz_id:bool ->
?pval:bool ->
Format.formatter ->
func ->
unitval pp_def : Format.formatter -> def_type -> unit