Module Permissions

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

type result = (TypeCore.env * Derivations.derivation, Derivations.derivation) Either.either 
The module internally can explore several solutions, but in order not to propagate this complexity outside the Permissions module, we chose to pick either an arbitrary solution (along with the corresponding derivation), or an arbitrary failed 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 sub_perm : TypeCore.env -> TypeCore.typ -> result
val add_hint : option -> string -> 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.
val instantiate_flexible : TypeCore.env -> TypeCore.var -> TypeCore.typ -> TypeCore.env option
The safe version of the function found in TypeCore.
val import_flex_instanciations : TypeCore.env -> TypeCore.env -> TypeCore.env
The safe version of the function found in TypeCore.
val drop_derivation : result -> TypeCore.env option
Drop the derivation information and just get an env option.