Skip to content

Commit 400c3cb

Browse files
committed
add mode.crossing.top and bot
1 parent baf7423 commit 400c3cb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

typing/mode.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,6 +3064,10 @@ module Crossing = struct
30643064

30653065
let le (t0 : t) (t1 : t) =
30663066
match t0, t1 with Join_const c0, Join_const c1 -> Mode.Const.le c1 c0
3067+
3068+
let top : t = Join_const Mode.Const.min
3069+
3070+
let bot : t = Join_const Mode.Const.max
30673071
end
30683072

30693073
module Comonadic = struct
@@ -3089,6 +3093,10 @@ module Crossing = struct
30893093

30903094
let le (t0 : t) (t1 : t) =
30913095
match t0, t1 with Meet_const c0, Meet_const c1 -> Mode.Const.le c0 c1
3096+
3097+
let top : t = Meet_const Mode.Const.max
3098+
3099+
let bot : t = Meet_const Mode.Const.min
30923100
end
30933101

30943102
type t = (Monadic.t, Comonadic.t) monadic_comonadic
@@ -3145,6 +3153,10 @@ module Crossing = struct
31453153
let le t0 t1 =
31463154
Monadic.le t0.monadic t1.monadic && Comonadic.le t0.comonadic t1.comonadic
31473155

3156+
let top = { monadic = Monadic.top; comonadic = Comonadic.top }
3157+
3158+
let bot = { monadic = Monadic.bot; comonadic = Comonadic.bot }
3159+
31483160
let print ppf t =
31493161
let print_atom ppf = function
31503162
| Modality.Atom (ax, Join_with c) -> C.print (Value.proj_obj ax) ppf c

typing/mode_intf.mli

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,12 @@ module type S = sig
734734
(** [le t0 t1] returns [true] if [t0] allows more mode crossing than [t1]. *)
735735
val le : t -> t -> bool
736736

737+
(** The trivial mode crossing that crosses nothing. *)
738+
val top : t
739+
740+
(** The mode crossing that crosses everything. *)
741+
val bot : t
742+
737743
(** Print the mode crossing by axis. Omit axes that do not cross. *)
738744
val print : Format.formatter -> t -> unit
739745
end

0 commit comments

Comments
 (0)