jon.recoil.org

Module Mode.Modality

module Comonadic : sig ... end
module Monadic : sig ... end
module Axis : sig ... end
module Per_axis : sig ... end
module Const : sig ... end
type t

A modality that acts on Value modes. Conceptually it is a record where individual fields can be set or proj.

The identity modality.

The undefined modality.

Apply a modality on a left mode. The calller should ensure that apply t m is only called for m >= md_mode for inferred modalities.

sub t0 t1 checks that t0 <= t1. Definition: t0 <= t1 iff forall a. t0(a) <= t1(a).

In case of failure, Error (ax, {left; right}) is returned, where ax is the axis on which the modalities disagree. left is the projection of t0 on ax, and right is the projection of t1 on ax.

equate t0 t1 checks that t0 = t1. Definition: t0 = t1 iff t0 <= t1 and t1 <= t0.

Printing for debugging.

Given md_mode the mode of a module, and mode the mode of a value to be put in that module, return the inferred modality to be put on the value description in the inferred module type.

The caller should ensure that for comonadic axes, md_mode >= mode.

Zap an inferred modality towards identity modality.

Zap an inferred modality towards the lowest (strongest) modality.

Asserts the given modality is a const modality, and returns it.

Checks if the given modality is a const modality

Inject a constant modality.

The top modality; sub x max succeeds for any x.