package ppx_derive_at_runtime

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Ppx_derive_at_runtime_example.ComparisonSource

Defines how to derive compare and equal using ppx_derive_at_runtime.

This is an example of an _extensional_ derivation: only the contents of a type matter, not syntactic details like constructor names, or whether a product type is represented as a tuple or as a record.

Internally, it is implemented with Ppx_derive_at_runtime_lib.Of_basic.

Sourcetype 'a t = {
  1. compare : 'a -> 'a -> Base.int;
  2. equal : 'a -> 'a -> Base.bool;
}
Sourceval create_m : (module Base.Comparable.S with type t = 'a) -> 'a t
Sourceval unmap : 'a t -> f:('b -> 'a) -> 'b t
Sourcemodule Export : sig ... end
Sourcemodule Ignore : sig ... end

Derives t. Types, record labels, variant constructors, and polymorphic variant rows can be annotated with [@comparison Ignore] to create a t that treats all values as equal.

include Ppx_derive_at_runtime_lib.S_with_basic_attribute with type 'a t := 'a t and type _ attribute := Ignore.t
Sourcemodule Derive : sig ... end
OCaml

Innovation. Community. Security.