Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
A Plugin.t
is a pair of functions that extend a representable type with specialised generic operations: one to supply the implementation of the specialistion, and one to supply its type.
For instance, the generic operation equal : 'a Repr.t -> 'a -> 'a -> equal
could be packaged as the following plugin:
create
~intf:(fun loc t -> [%type: [%t t] -> [%t t] -> bool])
~impl:(fun loc t -> [%expr Repr.unstage (Repr.equal [%e t])])
That is:
t
, its equality function has type t -> t -> bool
,t
, we can derive an equality function via Repr.equal
.val create :
?type_name:[ `before | `after ] ->
impl:(Ppxlib.location -> Ppxlib.expression -> Ppxlib.expression) ->
intf:(Ppxlib.location -> Ppxlib.core_type -> Ppxlib.core_type) ->
string ->
t
val derive_str :
t ->
loc:Ppxlib.location ->
type_name:string ->
params:string list ->
expr:Ppxlib.expression ->
Ppxlib.structure_item
val derive_sig :
t ->
loc:Ppxlib.location ->
type_name:string ->
params:Ppxlib.core_type list ->
ctyp:Ppxlib.core_type ->
Ppxlib.signature_item
val defaults : t list
Default set of plugins, using the generic operations provided by Repr
.