Module Generic_core_desc.Poly

module Poly: sig .. end
Generic representation of polymorphic variants.


Polymorphic variants have a different memory representation than normal variants, as such they need a distinct generic description.

Each constructor of a polymorphic variant is associated to a hash value, thus we provide operations to compute that hash value and operations to compute the constructor corresponding to a given hash.

type 'v t 
Abstract type representing the set of constructors in a polymorphic variant type
val poly_variant : 'v Generic_core_desc.Con.t list -> 'v t
Returns the abstract description of the polymorphic variant given the list of its constructors.
val find : 'v t -> int -> 'v Generic_core_desc.Con.t
Returns the constructor corresponding to the hash value.
val hash : 'v Generic_core_desc.Con.t -> int
Returns the hash value of a polymorphic constructor.
val conap : 'v t -> 'v -> 'v Generic_core_desc.Con.conap
Deconstructs a value of a polymorphic variant into the pair of its constructor and its arguments.
type '_ Ty.T.ty += 
| Poly_variant : 'v t -> 'v Ty.T.ty
Polymorphic variants are not named types but are given by providing all the constructors, therefore to witness a polymorphic variant type v, we provide a value v Desc.Poly.t.