Functor Type.Polymorphic


module Polymorphic: 
functor (D : sig
val name : 'a Type.t -> string
How to build a name for each monomorphic instance of the type value from the underlying type.
val value_name : string
The name of the built module.
type 'a t 
Static polymorphic type corresponding to its dynamic counterpart to register.
val repr : 'a -> 'a t
How to make the representant of each monomorphic instance of the polymorphic type value from an underlying representant.
val pp : (Type.precedence -> Format.formatter -> 'a -> unit) ->
Type.precedence -> Format.formatter -> 'a t -> unit
How to pretty print values with the help of a pretty printer for the underlying type. Use no_pp if you don't want to register a pretty printer.
end) -> POLYMORPHIC with type 'a poly = 'a D.t
Generic implementation of polymorphic type value.
Parameters:
D : sig val name: 'a t -> string (** How to build a name for each monomorphic instance of the type value from the underlying type. *) val value_name: string (** The name of the built module. *) type 'a t (** Static polymorphic type corresponding to its dynamic counterpart to register. *) val repr: 'a -> 'a t (** How to make the representant of each monomorphic instance of the polymorphic type value from an underlying representant. *) val pp: (precedence -> Format.formatter -> 'a -> unit) -> precedence -> Format.formatter -> 'a t -> unit (** How to pretty print values with the help of a pretty printer for the underlying type. Use {!no_pp} if you don't want to register a pretty printer. *) end

type 'a poly 
Type of the polymorphic type. It must be instantiated before used. See function instantiate below.
val instantiate : 'a Type.t -> 'a poly Type.t
Returns the monomorphic instantiation of the polymorph type with the given type value. For instance, if 'a poly = 'a list, then instantiate int returns the type value int list.
val is_instance_of : 'a Type.t -> bool
Returns true iff the given type value has been created from function instantiate above. For instance, is_instance_of (instantiate int) always returns true but is_instance_of int always returns false.
val get_instance : 'a poly Type.t -> 'a Type.t
get_instance ty returns the type value used to create the given monomorphic instantiation.