Module Abstract.Repr

Public representations.

type 't gist := 't t
type ('a, 'repr) t

The type for representing abtract types of type 'a with public values of type 'repr.

val make : ?meta:'repr Meta.t -> version:string -> 'repr gist -> ('a -> 'repr) -> ('repr -> 'a) -> ('a, 'repr) t

make ~version r inject project is a public representation for abstract type 't with:

  • version is a version name for the public representation. Intepretation is left to users, usually testing with string equality should be sufficient.
  • r is the representation representing the abstract type.
  • inject injects abstract types in the public representation.
  • project projects the public representation into the abstract type.
  • meta metadata for the representation.
val meta : ('a, 'repr) t -> 'repr Meta.t

meta r is the metadata of r.

val version : ('a, 'repr) t -> string

version r is a version name for the representation.

val gist : ('a, 'repr) t -> 'repr gist

gist r is the public representation of r.

val inject : ('a, 'repr) t -> 'a -> 'repr

inject r injects the abstract type into the public type.

val project : ('a, 'repr) t -> 'repr -> 'a

project r projects the public representation in the abstract type.