Module Mode.Statefulness

module Const : sig ... end
include Common_axis_pos with module Const := Const
include Mode_intf.Common_axis with module Const := Const and type 'd t = (Const.t, 'd Allowance.pos) mode and type 'd hint_const := 'd Mode_intf.pos_hint_const
include Mode_intf.Common with module Const := Const and type simple_error = Const.t Mode_intf.simple_error with type 'd t = (Const.t, 'd Allowance.pos) mode
type error

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.

type equate_error = Mode_intf.equate_step * error
type simple_error = Const.t Mode_intf.simple_error
val to_simple_error : error -> simple_error
type 'd t = (Const.t, 'd Allowance.pos) mode

Left-only mode

Right-only mode

Left-right mode

include Allowance.Allow_disallow with type (_, _, 'd) sided = 'd t
type (_, _, 'd) sided = 'd t
val disallow_right : ('a, 'b, 'l * 'r) sided -> ('a, 'b, 'l * Allowance.disallowed) sided

Disallows on the right.

val disallow_left : ('a, 'b, 'l * 'r) sided -> ('a, 'b, Allowance.disallowed * 'r) sided

Disallows a the left.

val allow_right : ('a, 'b, 'l * Allowance.allowed) sided -> ('a, 'b, 'l * 'r) sided

Generalizes a right-hand-side allowed to be any allowance.

val allow_left : ('a, 'b, Allowance.allowed * 'r) sided -> ('a, 'b, 'l * 'r) sided

Generalizes a left-hand-side allowed to be any allowance.

val min : lr
val max : lr
val legacy : lr
val newvar : unit -> ('l * 'r) t
val submode : ?pp:Mode_hint.pinpoint -> (Allowance.allowed * 'r) t -> ('l * Allowance.allowed) t -> (unit, error) result

Takes 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 -> unit

Similar 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 equate : lr -> lr -> (unit, equate_error) result
val submode_exn : ?pp:Mode_hint.pinpoint -> (Allowance.allowed * 'r) t -> ('l * Allowance.allowed) t -> unit

Similiar to submode, but crashes the compiler if errors. Use this function if the submode is guaranteed to succeed.

val equate_exn : lr -> lr -> unit
val join : (Allowance.allowed * 'r) t list -> Allowance.left_only t
val meet : ('l * Allowance.allowed) t list -> Allowance.right_only t
val newvar_above : (Allowance.allowed * 'r) t -> ('l * 'r_) t * bool
val newvar_below : ('l * Allowance.allowed) t -> ('l_ * 'r) t * bool
val print : ?verbose:bool -> unit -> Format.formatter -> ('l * 'r) t -> unit
val zap_to_ceil : ('l * Allowance.allowed) t -> Const.t
val zap_to_floor : (Allowance.allowed * 'r) t -> Const.t
val of_const : ?hint:'d Mode_intf.pos_hint_const -> Const.t -> 'd t
val stateless : lr
val observing : lr
val stateful : lr