module Gen: sig
.. end
val exApp_of_list : Camlp4.PreCast.Ast.expr list -> Camlp4.PreCast.Ast.expr
expr_app_of_list l
takes a list of expressions e1;e2;e3...
and returns
the expression e1 e2 e3
. c.f.: Ast.exSem_of_list
val tyArr_of_list : Camlp4.PreCast.Ast.ctyp list -> Camlp4.PreCast.Ast.ctyp
tyArr_of_list l
takes a list of types e1;e2;e3...
and returns
the type e1 e2 e3
. c.f.: Ast.exSem_of_list
val paOr_of_list : Camlp4.PreCast.Ast.patt list -> Camlp4.PreCast.Ast.patt
paOr_of_list l
takes a list of patterns p1;p2;p3...
and returns the
pattern p1 | p2 | p3
...
val gensym : ?prefix:string -> unit -> string
gensym ?prefix ()
generates a fresh variable name with the prefix
prefix
. The default value for prefix is "_x". When used with the default
parameters it will generate return: _x__001
,_x__002
,_x__003
...
val error : Camlp4.PreCast.Ast.ctyp -> fn:string -> msg:string -> 'a
error tp ~fn ~msg
raises an error with msg
on type tp
occuring in function fn
val unknown_type : Camlp4.PreCast.Ast.ctyp -> string -> 'a
unknown_type tp fn
type tp
is not handled by the function fn
val ty_var_list_of_ctyp : Camlp4.PreCast.Ast.ctyp -> string list -> string list
ty_var_list_of_ctyp tp acc
accumulates a list of type parameters
contained in tp
into acc
as strings.
val get_rev_id_path : Camlp4.PreCast.Ast.ident -> string list -> string list
get_rev_id_path id acc
takes an identifier.
Returns a reversed
module path (list of strings) denoting this identifier, appending
it to acc
.
val ident_of_rev_path : Camlp4.PreCast.Ast.Loc.t -> string list -> Camlp4.PreCast.Ast.ident
ident_of_rev_path loc path
takes a location loc
and a reversed path
rev_path
to an identifier.
Returns identifier denoting the
bound value.
val get_appl_path : Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.ident
get_appl_path loc tp
Returns the identifier path associated with
a polymorphic type.
val abstract : Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.patt list ->
Camlp4.PreCast.Ast.expr -> Camlp4.PreCast.Ast.expr
abstract loc patts body
takes a location loc
, a pattern list
patts
, and an expression body
.
Returns a function expression
that takes the patterns as arguments, and binds them in body
.
val apply : Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.expr ->
Camlp4.PreCast.Ast.expr list -> Camlp4.PreCast.Ast.expr
apply loc f_expr arg_exprs
takes a location loc
, an expression
f_expr
representing a function, and a list of argument expressions
arg_exprs
.
Returns an expression in which the function is
applied to its arguments.
val idp : Camlp4.PreCast.Ast.Loc.t -> string -> Camlp4.PreCast.Ast.patt
idp loc name
val ide : Camlp4.PreCast.Ast.Loc.t -> string -> Camlp4.PreCast.Ast.expr
ide loc name
val switch_tp_def : alias:(Camlp4.PreCast.Ast.Loc.t -> Camlp4.PreCast.Ast.ctyp -> 'a) ->
sum:(Camlp4.PreCast.Ast.Loc.t -> Camlp4.PreCast.Ast.ctyp -> 'a) ->
record:(Camlp4.PreCast.Ast.Loc.t -> Camlp4.PreCast.Ast.ctyp -> 'a) ->
variants:(Camlp4.PreCast.Ast.Loc.t -> Camlp4.PreCast.Ast.ctyp -> 'a) ->
mani:(Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.ctyp -> 'a) ->
nil:(Camlp4.PreCast.Ast.Loc.t -> 'a) -> Camlp4.PreCast.Ast.ctyp -> 'a
switch_tp_def ~alias ~sum ~record ~variants ~mani tp_def
takes a handler function for each kind of type definition and
applies the appropriate handler when tp_def
matches.
val mk_expr_lst : Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.expr list -> Camlp4.PreCast.Ast.expr
mk_expr_lst loc expr_list
takes a list of expressions.
Returns an expression representing a list of expressions.
val mk_patt_lst : Camlp4.PreCast.Ast.Loc.t ->
Camlp4.PreCast.Ast.patt list -> Camlp4.PreCast.Ast.patt
mk_patt_lst _loc patt_list
takes a list of patterns.
Returns a pattern representing a list of patterns.
val get_tparam_id : Camlp4.PreCast.Ast.ctyp -> string
get_tparam_id tp
Raises Failure
otherwise.
Returns the string identifier associated with
tp
if it is a type parameter.
val type_is_recursive : string -> Camlp4.PreCast.Ast.ctyp -> bool
type_is_recursive _loc id tp
Returns whether the type tp
with name id
refers to itself, assuming that it is not mutually
recursive with another type.
val drop_variance_annotations : Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.ctyp
drop_variance_annotations _loc tp
Returns the type resulting
from dropping all variance annotations in tp
.