Abstract.Repr
Public representations.
type 't gist := 't 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 version : ('a, 'repr) t -> string
version r
is a version name for the representation.
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.