Mlsem_types.TVOpval all_vars : kind -> Mlsem_types__.Tvar.MVarSet.tEvery type and row variable of that kind created since the program started (cf. Var.all_vars). all_vars KNoInfer is the set of rigid variables passed as monomorphic to tally.
val vars : Ty.t -> Mlsem_types__.Tvar.MVarSet.tAll the variables of a type. This is a syntactic notion inherited from sstt: a variable that does not affect the denotation of the type may or may not be reported, depending on the simplifications already applied to it.
val vars' : Ty.t list -> Mlsem_types__.Tvar.MVarSet.tval top_vars : Ty.t -> Mlsem_types__.Tvar.MVarSet.tOnly the variables occurring at top level, i.e. not under a type constructor.
val strict_vars : Ty.t -> Mlsem_types__.Tvar.MVarSet.tOnly the variables occurring strictly under a type constructor.
`Pos (resp. `Neg) means the type is monotonic (resp. anti-monotonic) in the variable, `Both that it is neither, and `None that the variable does not affect the denotation at all — which can happen because vars is syntactic, so a reported variable may be vacuous.
The primed variants below combine the polarities over a list of types, as if the variable occurred in each of them. Variables of polarity `None are omitted from the results.
val is_ground_typ : Ty.t -> boolval refresh :
?preserve_names:bool ->
kind:kind ->
Mlsem_types__.Tvar.MVarSet.t ->
Mlsem_types__.Tvar.Subst.tA substitution renaming each given variable to a fresh one of the given kind. With ~preserve_names:true the fresh variables keep the display name of the originals, which makes them indistinguishable when printed with TVar.pp.
val shorten_names :
?kind:kind ->
Mlsem_types__.Tvar.MVarSet.t ->
Mlsem_types__.Tvar.Subst.tA substitution renaming the given variables to fresh ones named a, b, … — for display only.
val pp_typ_short : Stdlib.Format.formatter -> Ty.t -> unitPrints with variables renamed by shorten_names.
val pp_typ_uniq : Stdlib.Format.formatter -> Ty.t -> unitPrints with variables renamed so that distinct variables print differently, even when they share a display name.
val pp_typ_subst :
Mlsem_types__.Tvar.Subst.t ->
Stdlib.Format.formatter ->
Ty.t ->
unitPrints the type after applying the given substitution.
val clean :
pos1:Ty.t ->
neg1:Ty.t ->
pos2:Mlsem_types__.Tvar.Row.t ->
neg2:Mlsem_types__.Tvar.Row.t ->
Mlsem_types__.Tvar.MVarSet.t ->
Ty.t ->
Ty.tclean p n mono t substitutes in t all variables not in mono and only occurring positively by p, and all variables not in mono and only occurring negatively by n
The smallest instance of the type, obtained by cleaning the variables outside mono with empty positively and any negatively.
Dual of bot_instance: the largest instance.
val tally :
?record:bool ->
Mlsem_types__.Tvar.MVarSet.t ->
(Ty.t * Ty.t) list ->
Mlsem_types__.Tvar.Subst.t listtally mono cs returns substitutions — of the variables not in mono — that make every constraint (s,t) of cs satisfy s ≤ t. The empty list means the constraints are unsatisfiable. Set ~record:false to keep the instance out of Recording's log; this matters for calls made while comparing candidate solutions, which are not part of the derivation being built.
val tally_const_rows :
?record:bool ->
Mlsem_types__.Tvar.MVarSet.t ->
(Ty.t * Ty.t) list ->
Mlsem_types__.Tvar.Subst.t listLike tally, but row variables are not instantiated with rows that introduce new fields.
val decompose :
Mlsem_types__.Tvar.MVarSet.t ->
Mlsem_types__.Tvar.Subst.t ->
Mlsem_types__.Tvar.Subst.t ->
Mlsem_types__.Tvar.Subst.t listdecompose mono s1 s2 returns the substitutions s such that applying s after s2 is at least as precise as s1; the empty list when s1 is not an instance of s2. Used to compare candidate solutions.
factorize (pvs,nvs) t splits t into a part that can be factorized by pvs and nvs, and a remainder: it returns (t1,t2) such that t is equivalent to (/\pvs /\ ~\/nvs /\ t1) \/ t2. The factorized part gathers the DNF lines of t in which every variable of pvs occurs positively and every variable of nvs occurs negatively, with those occurrences removed.