Module Ppx_deriving_toolsSource

A collection of tools to make it easy to build ppx deriving plugins.

Sourceclass virtual deriving : object ... end

A deriver is represented by this api

Sourceval register : ?deps:Ppxlib.Deriving.t list -> deriving -> Ppxlib.Deriving.t

handles registration of the deriver

Sourceval register_combined : ?deps:Ppxlib.Deriving.t list -> Ppxlib.label -> deriving list -> Ppxlib.Deriving.t

multiple derivers can be registered under the same name

Sourcemodule Conv : sig ... end

A common scheme to define data conversions (like to_json/of_json).

Sourceval not_supported : loc:Ppxlib.location -> string -> 'a

not_supported what terminates ppx with an error message telling what unsupported.

Sourceval gen_tuple : loc:Ppxlib.location -> Ppxlib.label -> int -> Ppxlib.pattern list * Ppxlib.expression

let patts, expr = gen_tuple label n in ... creates a tuple expression and a corresponding list of patterns.

Auxiliary functions to generate record expressions and patterns.

let patts, expr = gen_tuple label n in ... creates a record expression and a corresponding list of patterns.

Sourceval gen_pat_tuple : loc:Ppxlib.location -> string -> int -> Ppxlib.pattern * Ppxlib.expression list

let patt, exprs = gen_pat_tuple ~loc prefix n in ... generates a pattern to match a tuple of size n and a list of expressions exprs to refer to names bound in this pattern.

Sourceval gen_pat_record : loc:Ppxlib.location -> string -> Ppxlib.label Ppxlib.loc list -> Ppxlib.pattern * Ppxlib.expression list

let patt, exprs = gen_pat_record ~loc prefix fs in ... generates a pattern to match record with fields fs and a list of expressions exprs to refer to names bound in this pattern.

Sourceval gen_pat_list : loc:Ppxlib.location -> string -> int -> Ppxlib.pattern * Ppxlib.expression list

let patt, exprs = gen_pat_list ~loc prefix n in ... generates a pattern to match a list of size n and a list of expressions exprs to refer to names bound in this pattern.

A shortcut to define a pattern matching case.

Sourceval map_loc : ('a -> 'b) -> 'a Ppxlib.loc -> 'b Ppxlib.loc

Map over data with location, useful to lift derive_of_label, derive_of_longident

Low-level deriver classes.

Sourceclass virtual deriving1 : object ... end

1-arity deriver