package ppx_derive_at_runtime

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'a t
type 'a attribute
val map_unmap : 'a t -> to_:('a -> 'b) -> of_:('b -> 'a) -> 'b t

Transforms an 'a t to a 'b t.

In covariant types, only to_ is needed. Examples include type 'a t = 'a list and type 'a t = Sexp.t -> 'a.

In contravariant types, only of_ is needed. Examples include type 'a t = 'a -> Sexp.t.

Invariant types need both to_ and of_. Examples include type 'a t = 'a -> 'a and type 'a t = 'a ref.

Monomorphic types need neither to_ nor of_. Examples include type 'a t = unit.

val unit : Base.unit t

Derives values from singleton types.

val nothing : Base.Nothing.t t

Derives values from uninhabited types.

val both : 'a t -> 'b t -> ('a * 'b) t

Derives values from product types.

val either : 'a t -> 'b t -> ('a, 'b) Base.Either.t t

Derives values from sum types.

val recursive : 'a t Base.Lazy.t -> 'a t

Derives values from recursive types.

val with_attribute : 'a t -> 'a attribute -> 'a t

Derives values from types annotated with an appropriate attribute. See ../README.mdx.

OCaml

Innovation. Community. Security.