Module Mode.ValueSource
The most general mode. Used in most type checking, including in value bindings in Env
type ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j) modes = {areality : 'a;linearity : 'b;uniqueness : 'c;portability : 'd;contention : 'e;forkable : 'f;yielding : 'g;statefulness : 'h;visibility : 'i;staticity : 'j;
}type 'a simple_axerror := 'a simple_errorinclude Mode_intf.Common
with module Const := Const
and type error := error
and type simple_error := simple_error
and type 'd t := 'd t
Takes a submode error accompanied by a pinpoint of the original submode, returns an explaining printer for each side. Each printer prints either a mode constant name, or "mode because ...". The function assumes pinpoint is already printed, which allows simplifying its own printing. The caller is responsible for printing pinpoint and placing the result of this function in a suitable linguistic context.
Left-only mode
Right-only mode
Left-right mode
include Allowance.Allow_disallow with type (_, _, 'd) sided = 'd t
Disallows on the right.
Disallows a the left.
Generalizes a right-hand-side allowed to be any allowance.
Generalizes a left-hand-side allowed to be any allowance.
val submode :
?pp:Mode_hint.pinpoint ->
(Allowance.allowed * 'r) t ->
('l * Allowance.allowed) t ->
(unit, error) resultTakes the actual and expected mode of something, check that the actual mode is less than the expected mode. In case of error, the error is returned and no mutation is done.
The two modes should be hinted sufficently that the submode is self-evident. In particular, the two modes should be about the "same thing". See the notes How to submode for details.
val submode_err :
Mode_hint.pinpoint ->
(Allowance.allowed * 'r) t ->
('l * Allowance.allowed) t ->
unitSimilar to submode, but instead of returning an error, raise user-friendly errors directly, with pinpoint describing the thing whose actual and expected modes are being checked.
If you need more than pinpoint as the context in the error message, consider submode.
val submode_exn :
?pp:Mode_hint.pinpoint ->
(Allowance.allowed * 'r) t ->
('l * Allowance.allowed) t ->
unitSimiliar to submode, but crashes the compiler if errors. Use this function if the submode is guaranteed to succeed.
val print :
?verbose:bool ->
unit ->
Ocaml_typing.Mode_intf.Fmt.formatter ->
('l * 'r) t ->
unitval of_const :
?hint_monadic:('l * 'r) Allowance.neg Hint.const ->
?hint_comonadic:('l * 'r) Allowance.pos Hint.const ->
Const.t ->
('l * 'r) tmax_with ax elt returns max but with the axis ax set to elt.
min_with ax elt returns min but with the axis ax set to elt.
val comonadic_to_monadic_min :
?hint:('r * disallowed) Allowance.neg Hint.morph ->
('l * 'r) Comonadic.t ->
('r * disallowed) Monadic.tval close_over :
(('l * allowed) Monadic.t, (allowed * 'r) Comonadic.t) monadic_comonadic ->
lReturns the lower bound needed for B -> C in relation to A