Module Generic_core.Repr

module Repr: Generic_core_repr
Representation of abstract datatypes.

type ('a, 'b) repr_by = {
   repr_ty : 'b Ty.T.ty; (*
Representation type.
*)
   to_repr : 'a -> 'b; (*
Conversion from the abstract type to the representation.
*)
   from_repr : 'b -> 'a option; (*
Partial conversion from representation to the abstract type. May fail if the representation isn't valid.
*)
   default : 'a; (*
Default value, used temporarily when converting cyclic data.
*)
   update : 'a -> 'b -> unit; (*
Restore the cycles.
*)
}
(a,b) repr_by explains how a is represented by b.
type 'a repr = 
| Repr : ('a0, 'b) repr_by -> 'a0 repr
The concrete representation type is existentially quantified. Thus the type a repr means: a is representable.
type 'a t = 'a repr 
A synonym, so that repr might be referred to as Repr.t
type repr_fun = {
   f : 'a. 'a Ty.T.ty -> 'a repr;
}
Type-indexed function that associates a representation to an abstract type.
val repr : 'a Ty.T.ty -> 'a repr
Returns the representation associated to an abstract type.
val view : 'a Ty.T.ty -> 'a repr
synonym of Generic_core_repr.repr
val ext : 'a Ty.pat -> repr_fun -> unit
ext t f extends function repr with a new case for type t defined by f.
val repr_name : string