Legend:
Library
Module
Module type
Parameter
Class
Class type
Inner Terms
Those terms are not designed to be used directly, but rather to provide a generic backend (implementing De Bruijn indices, subterms, substitutions, etc.) for other more specific representations like Type.t and Term.t.
The point is that we only have to do substitution, hashconsing, and De Bruijn indices manipulation in one place; it also makes it easy to make terms and types occur in one another (types as parameters to terms, etc.)
NOTE: this should be used with a lot of caution. Few checks are performed (even typing checks) and it is easy to obtain non-closed terms or ill-typed terms by manipulating this carelessly.
Some constructors, such as record, may raise IllFormedTermif the arguments are ill-formed (several occurrences of a key), or, for variables, if the number is negative
open_poly_fun ty "unrolls" polymorphic function arrows from the left, so that open_poly_fun (forall a b. f a -> (g b -> (c -> d))) returns 2; [f a;g b;c], d.
returns
the return type, the number of type variables, and the list of all its arguments
type print_hook =
int ->tCCFormat.printer->Stdlib.Format.formatter ->t->
bool
User-provided hook that can be used to print terms (for composite cases) before the default printing occurs. The int argument is the De Bruijn depth in the term. A hook takes as arguments the depth and the recursive printing function that it can use to print subterms. A hook should return true if it fired, false to fall back on the default printing.