package ppx_typed_fields

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

Module Typed_fields_lib.UnitSource

This is a convenient module for deriving typed_fields on unit, which you can conceptually think of as a record with no fields. OCaml does not support actual record types with no fields.

Sourcetype 'a t = |
include S with type derived_on = Base.unit and type 'a t := 'a t
Sourcetype derived_on = Base.unit
Sourceval name : 'a t -> Base.string

The name of the field, e.g. "rgb" from the example above.

Sourceval path : 'a t -> Base.string Base.list

The path of a field, e.g. "rgb" from the example above. The list will have multiple elements if the field is a subproduct.

Sourceval __ord : 'a t -> Base.int Base.list
Sourcemodule Type_ids : sig ... end
Sourcemodule Packed : sig ... end

Packed is useful for making collections of 'a t's with different 'a's.

Sourcetype creator = {
  1. f : 'a. 'a t -> 'a;
}
Sourceval get : 'a t -> derived_on -> 'a
Sourceval set : 'a t -> derived_on -> 'a -> derived_on
Sourceval create : creator -> derived_on