package ppx_irmin
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=af3837ddeaaabdde6c77cc46b87e8edbdef3539b1a0a8e329a0bd6b6fec928ca
sha512=5bd2be34d61acf42a6c4e29f7b87fc15223ffa46546d6fb411f7519824ca8fd51f0db001787298f31c702998e73145c314b30e3e994154d0b3f63efe5f038976
doc/ppx_irmin._lib/Ppx_irmin_lib/Deriver/Located/argument-1-A/index.html
Parameter Located.A
module Located : sig ... end
include sig ... end
val loc : Ppxlib.Location.t
val class_infos :
virt:Migrate_parsetree__.Ast_408.Asttypes.virtual_flag ->
params:
(Migrate_parsetree__.Ast_408.Parsetree.core_type
* Migrate_parsetree__.Ast_408.Asttypes.variance)
list ->
name:string Ppxlib_ast__.Import.Location.loc ->
expr:'a ->
'a Migrate_parsetree__.Ast_408.Parsetree.class_infos
val pexp_for :
Migrate_parsetree__.Ast_408.Parsetree.pattern ->
Migrate_parsetree__.Ast_408.Parsetree.expression ->
Migrate_parsetree__.Ast_408.Parsetree.expression ->
Migrate_parsetree__.Ast_408.Asttypes.direction_flag ->
Migrate_parsetree__.Ast_408.Parsetree.expression ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val location :
start:Lexing.position ->
end_:Lexing.position ->
ghost:bool ->
Ppxlib_ast__.Import.Location.t
val position :
fname:string ->
lnum:int ->
bol:int ->
cnum:int ->
Lexing.position
val type_declaration :
name:string Ppxlib_ast__.Import.Location.loc ->
params:
(Migrate_parsetree__.Ast_408.Parsetree.core_type
* Migrate_parsetree__.Ast_408.Asttypes.variance)
list ->
cstrs:
(Migrate_parsetree__.Ast_408.Parsetree.core_type
* Migrate_parsetree__.Ast_408.Parsetree.core_type
* Ppxlib_ast__.Import.Location.t)
list ->
kind:Migrate_parsetree__.Ast_408.Parsetree.type_kind ->
private_:Migrate_parsetree__.Ast_408.Asttypes.private_flag ->
manifest:Migrate_parsetree__.Ast_408.Parsetree.core_type option ->
Migrate_parsetree__.Ast_408.Parsetree.type_declaration
val type_extension :
path:Ppxlib_ast__.Import.Longident.t Ppxlib_ast__.Import.Location.loc ->
params:
(Migrate_parsetree__.Ast_408.Parsetree.core_type
* Migrate_parsetree__.Ast_408.Asttypes.variance)
list ->
constructors:Migrate_parsetree__.Ast_408.Parsetree.extension_constructor list ->
private_:Migrate_parsetree__.Ast_408.Asttypes.private_flag ->
Migrate_parsetree__.Ast_408.Parsetree.type_extension
val eint : Base.Int.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val echar : Base.Char.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val estring : Base.String.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val efloat : Base.String.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val eint32 : Base.Int32.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val eint64 : Base.Int64.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val enativeint :
Base.Nativeint.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val ebool : Base.Bool.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
val pint : Base.Int.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val pchar : Base.Char.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val pstring : Base.String.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val pfloat : Base.String.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val pint32 : Base.Int32.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val pint64 : Base.Int64.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val pnativeint :
Base.Nativeint.t ->
Migrate_parsetree__.Ast_408.Parsetree.pattern
val pbool : Base.Bool.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val evar : Base.String.t -> Migrate_parsetree__.Ast_408.Parsetree.expression
evar id
produces a Pexp_ident _
expression, it parses its input so you can pass any dot-separated identifier, for instance: evar ~loc "Foo.bar"
.
val pvar : Base.String.t -> Migrate_parsetree__.Ast_408.Parsetree.pattern
val eapply :
Migrate_parsetree__.Ast_408.Parsetree.expression ->
Migrate_parsetree__.Ast_408.Parsetree.expression Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression
Same as pexp_apply but without labels
val eabstract :
Migrate_parsetree__.Ast_408.Parsetree.pattern Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val esequence :
Migrate_parsetree__.Ast_408.Parsetree.expression Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val ppat_tuple_opt :
Migrate_parsetree__.Ast_408.Parsetree.pattern Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.pattern Base.Option.t
val pexp_tuple_opt :
Migrate_parsetree__.Ast_408.Parsetree.expression Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression Base.Option.t
val pconstruct :
Migrate_parsetree__.Ast_408.Parsetree.constructor_declaration ->
Migrate_parsetree__.Ast_408.Parsetree.pattern Base.Option.t ->
Migrate_parsetree__.Ast_408.Parsetree.pattern
val econstruct :
Migrate_parsetree__.Ast_408.Parsetree.constructor_declaration ->
Migrate_parsetree__.Ast_408.Parsetree.expression Base.Option.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val elist :
Migrate_parsetree__.Ast_408.Parsetree.expression Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val plist :
Migrate_parsetree__.Ast_408.Parsetree.pattern Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.pattern
val pstr_value_list :
loc:Ppxlib.Location.t ->
Ppxlib_ast.Asttypes.rec_flag ->
Migrate_parsetree__.Ast_408.Parsetree.value_binding Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.structure_item Base.List.t
pstr_value_list ~loc rf vbs
= pstr_value ~loc rf vbs
if vbs <> []
, []
otherwise.
val nonrec_type_declaration :
name:Base.String.t Ppxlib.Loc.t ->
params:
(Migrate_parsetree__.Ast_408.Parsetree.core_type
* Ppxlib_ast.Asttypes.variance)
Base.List.t ->
cstrs:
(Migrate_parsetree__.Ast_408.Parsetree.core_type
* Migrate_parsetree__.Ast_408.Parsetree.core_type
* Ppxlib.Location.t)
Base.List.t ->
kind:Migrate_parsetree__.Ast_408.Parsetree.type_kind ->
private_:Ppxlib_ast.Asttypes.private_flag ->
manifest:Migrate_parsetree__.Ast_408.Parsetree.core_type Base.Option.t ->
Migrate_parsetree__.Ast_408.Parsetree.type_declaration
val unapplied_type_constr_conv :
Ppxlib.Longident.t Ppxlib.Loc.t ->
f:(Base.String.t -> Base.String.t) ->
Migrate_parsetree__.Ast_408.Parsetree.expression
unapplied_type_constr_conv
is the standard way to map identifiers to conversion fonctions, for preprocessor that creates values that follow the structure of types. More precisely, path_conv path (sprintf "sexp_of_%s")
is:
- sexp_of_t if path is "t"
- A.B.sexp_of_foo if path is "A.B.foo"
- A.B.sexp_of_f__foo (module A1) (module A2) if path is "A.B.F(A1)(A2).foo"
type_constr_conv
also applies it to a list of expression, which both prevents the compiler from allocating useless closures, and almost always what is needed, since type constructors are always applied.
val type_constr_conv :
Ppxlib.Longident.t Ppxlib.Loc.t ->
f:(Base.String.t -> Base.String.t) ->
Migrate_parsetree__.Ast_408.Parsetree.expression Base.List.t ->
Migrate_parsetree__.Ast_408.Parsetree.expression
val eta_reduce :
Migrate_parsetree__.Ast_408.Parsetree.expression ->
Migrate_parsetree__.Ast_408.Parsetree.expression Base.Option.t
Tries to simplify fun v1 v2 .. -> f v1 v2 ..
into f
. Only works when f
is a path, not an arbitrary expression as that would change the meaning of the code. This can be used either for cleaning up the generated code, or to reduce allocation if f
is a local variable (the compiler won't optimize the allocation of the closure).
Eta-reduction can change the types/behavior in some corner cases that are unlikely to show up in generated code:
- if
f
has optional arguments, eta-expandingf
can drop them - because labels commute, it can change the type of an expression: $ let f ~x y = x + y let f2 = fun x -> add x;; val f : x:int -> int -> int = <fun> val f2 : int -> x:int -> int = <fun> In fact, if
f
does side effects before receiving all its arguments, and if the eta-expansion is partially applied, eta-reducing could change behavior.
eta_reduce_if_possible_and_nonrec
is meant for the case where the resulting expression is going to be bound in a potentially recursive let-binding, where we have to keep the eta-expansion when rec_flag
is Recursive
to avoid a compile error.