Skip to content

Commit 2f1a8ed

Browse files
committed
small improvement
1 parent b1e1832 commit 2f1a8ed

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

typing/ctype.ml

+8-10
Original file line numberDiff line numberDiff line change
@@ -1665,16 +1665,14 @@ let with_locality_and_yielding (locality, yielding) m =
16651665
let m' = Alloc.newvar () in
16661666
Locality.equate_exn (Alloc.proj (Comonadic Areality) m') locality;
16671667
Yielding.equate_exn (Alloc.proj (Comonadic Yielding) m') yielding;
1668-
Alloc.submode_exn m'
1669-
(Alloc.join_with
1670-
(Comonadic Yielding)
1671-
Yielding.Const.max
1672-
(Alloc.join_with (Comonadic Areality) Locality.Const.max m));
1673-
Alloc.submode_exn
1674-
(Alloc.meet_with
1675-
(Comonadic Areality)
1676-
Locality.Const.min
1677-
(Alloc.meet_with (Comonadic Yielding) Yielding.Const.min m)) m';
1668+
Alloc.submode_exn m' (Alloc.join_const
1669+
{ Alloc.Const.min with
1670+
areality = Locality.Const.max;
1671+
yielding = Yielding.Const.max} m);
1672+
Alloc.submode_exn (Alloc.meet_const
1673+
{ Alloc.Const.max with
1674+
areality = Locality.Const.min;
1675+
yielding = Yielding.Const.min} m) m';
16781676
m'
16791677

16801678
let curry_mode alloc arg : Alloc.Const.t =

typing/mode.ml

+6
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,12 @@ module Value_with (Areality : Areality) = struct
21882188
let monadic = Monadic.meet_const c.monadic monadic in
21892189
{ monadic; comonadic }
21902190

2191+
let join_const c { comonadic; monadic } =
2192+
let c = split c in
2193+
let comonadic = Comonadic.join_const c.comonadic comonadic in
2194+
let monadic = Monadic.join_const c.monadic monadic in
2195+
{ monadic; comonadic }
2196+
21912197
let imply c { comonadic; monadic } =
21922198
let c = split c in
21932199
let comonadic = Comonadic.imply c.comonadic comonadic in

typing/mode_intf.mli

+2
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ module type S = sig
432432

433433
val meet_const : Const.t -> ('l * 'r) t -> ('l * 'r) t
434434

435+
val join_const : Const.t -> ('l * 'r) t -> ('l * 'r) t
436+
435437
val imply : Const.t -> ('l * 'r) t -> (disallowed * 'r) t
436438

437439
(* The following two are about the scenario where we partially apply a

0 commit comments

Comments
 (0)