package ppx_compare
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=f0b23eb78082ef4dc71a66939bbc63c6b0cc2cf6a4744a906b7a2c016cbe3098
doc/ppx_compare.expander/Ppx_compare_expander/Equal/index.html
Module Ppx_compare_expander.EqualSource
val type_ :
with_local:bool ->
hide:bool ->
loc:Ppxlib.Location.t ->
Ppxlib.core_type ->
Ppxlib.core_typetype_ ~with_local ~hide ty is ty -> ty -> result_type where result_type is int for compare and bool for equal.
hide controls whether some [@merlin.hide] attributes should be added.
with_local adds local_ annotation around the input types.
core_type ~with_local ty is an expression of type ty -> ty -> result_type
~with_local:true will make the arguments local
In str_type_decl and sig_type_decl, passing true for the third argument generates additional functions that take local arguments. We generate, e.g. val compare__local : local_ t -> local_ t -> int in addition to compare in order to incrementally grow the portion of the tree which supports local comparison.
We need both compare and compare__local since neither has a stronger type than the other. In the case of polymorphic types, this is due to the fact that compare__local requires local compare functions for each of its type arguments, and in the case of monomorphic types, this is due to the possibility of partial application producing a local closure.
val str_type_decl :
ctxt:Ppxlib.Expansion_context.Deriver.t ->
(Ppxlib.rec_flag * Ppxlib.type_declaration list) ->
bool ->
Ppxlib.structureval sig_type_decl :
ctxt:Ppxlib.Expansion_context.Deriver.t ->
(Ppxlib.rec_flag * Ppxlib.type_declaration list) ->
bool ->
Ppxlib.signature