Module Permissions

module Permissions: sig .. end
This module provides permission manipulation functions.

type result = TypeCore.env option * Derivations.derivation 
val unify : TypeCore.env -> TypeCore.var -> TypeCore.var -> TypeCore.env
unify env p1 p2 merges two vars, and takes care of dealing with how the permissions should be merged.
val add : TypeCore.env -> TypeCore.var -> TypeCore.typ -> TypeCore.env
add env var t adds t to the list of permissions for p, performing all the necessary legwork.
val add_perm : TypeCore.env -> TypeCore.typ -> TypeCore.env
add_perm env t adds a type t with kind PERM to env, returning the new environment.
val sub : TypeCore.env -> TypeCore.var -> TypeCore.typ -> result
sub env var t tries to extract t from the available permissions for var and returns, if successful, the resulting environment.
val sub_type : TypeCore.env -> TypeCore.typ -> TypeCore.typ -> result
sub_type env t1 t2 tries to perform t1 - t2. It is up to the caller to "do the right thing" by not discarding t1 if it was not duplicable. Unifications may be performed, hence the return environment.
val add_hint : TypeCore.name option -> string -> TypeCore.name option
val sub_constraint : TypeCore.env -> TypeCore.mode_constraint -> result
val keep_only_duplicable : TypeCore.env -> TypeCore.env
Only keep the duplicable portions of the environment.