package ppx_repr
PPX deriver for type representations
Install
Dune Dependency
Authors
Maintainers
Sources
repr-0.7.0.tbz
sha256=8adac9fe85bf8a0e20eeb6810d7216e98e1b7f4d9bd399e61bb1024ace2501ac
sha512=5b104c52a05a3ed7a4505dea3b3b7ee16bba020b5d2d8e4dfd680ff8f82ae021caf0f29207616ac2ae40dfd5bb641a144e31b11d29c5ba4918ba616a57f74647
doc/ppx_repr.lib/Ppx_repr_lib/Meta_deriving/Plugin/index.html
Module Meta_deriving.Plugin
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:
- given some type
t
, its equality function has typet -> t -> bool
, - given a runtime representation of
t
, we can derive an equality function viaRepr.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
.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>