module Ty:Functions for de-constructing values of typesig..end
'a tyrepr.type declaration
declaration is produced by the compiler for each
type declaration in a module. This allows at runtime to ``break
the abstraction barriers'' imposed by the type-checker...val name : declaration -> stringname decl returns the name of the type constructor defined by decl.val fullname : declaration -> stringfullname decl returns the name of the type constructor defined by decl,
as well as the line and file name of this decleration.val arity : declaration -> intarity decl returns the arity of the type constructor defined by decl.val is_alias : declaration -> boolis_alias decl returns true if decl is an alias type declaration.
When decl is abstract both on the structure and the signature, it
returns false.val is_datatype : declaration -> boolis_datatype decl returns true if decl is a record or sum type
declaration. When decl is abstract both on the structure and the
signature, it returns false.type expression
'a tyrepr.val dump : 'a tyrepr -> expressiondump function allows to project a type expression ([^ ty ^] :
ty tyrepr) to the type expression.val body : declaration -> expressionbody decl returns a type expression describing the body of the
type declaration decl.val canonical : expression -> expressioncanonical ty resolves type aliases and returns a type expression
that corresponds to a datatype declaration.
Therefore, desc (canonical ty)
Tconstr(decl,_) such that is_datatype(decl) is true.val equal : expression -> expression -> boolcanonical on
equal arguments.)val print : Format.formatter -> expression -> unittype description =
| |
Tunit |
| |
Tbool |
| |
Tint |
| |
Tnativeint |
| |
Tint32 |
| |
Tint64 |
| |
Tchar |
| |
Tstring |
| |
Tfloat |
| |
Texn |
| |
Tarray of |
| |
Tlist of |
| |
Toption of |
| |
Tlazy of |
| |
Ttyrepr of |
| |
Tformat4 of |
| |
Tconstr of |
| |
Ttuple of |
| |
Tarrow of |
| |
Tvariant of |
| |
Tabstract |
| |
Tsum of |
| |
Tdoublerecord of |
| |
Trecord of |
| |
Targ of |
| |
Tpoly of |
| |
Tvar of |
val desc : expression -> descriptiondesc ty returns a description of the type expression ty.
It corresponds to the type expression that we can write using
OCaml concrete syntax. It therefore excludes constructors such as
Tabstract, Tsum, Tdoublerecord or Trecord. See repr.
val repr : expression -> descriptionrepr ty returns the description of possible memory
representations for the type expression ty.
By contrast with desc ty, it can be Tabstract, Tsum,
Tdoublerecord ou Trecord, but not Tconstr.
Tvar i represents the constant Top of the
(currently only in French) formalization.val cut_head_quantification : expression -> expressioncut_head_quantification ty removes hypothetical headings
Tpoly _ from ty.val instance : expression -> expression -> boolinstance ty1 ty2 returns true when ty1 is a polymorphic
instance ty2.val antiunif : expression -> expression -> expression
We use Tvar (-1) for resolving conflicts.
val is_monomorphic : expression -> boolis_monomorphic ty returns true when ty contains no
occurrence of Tvar (-1).