@@ -2066,7 +2066,9 @@ module Comonadic_with (Areality : Areality) = struct
2066
2066
2067
2067
include Comonadic_gen (Obj )
2068
2068
2069
- type error = Error : (Obj .const , 'a ) C.Axis .t * 'a Solver .error -> error
2069
+ type 'a axis = (Obj .const , 'a ) C.Axis .t
2070
+
2071
+ type error = Error : 'a axis * 'a Solver .error -> error
2070
2072
2071
2073
type equate_error = equate_step * error
2072
2074
@@ -2208,7 +2210,9 @@ module Monadic = struct
2208
2210
2209
2211
include Monadic_gen (Obj )
2210
2212
2211
- type error = Error : (Obj .const , 'a ) C.Axis .t * 'a Solver .error -> error
2213
+ type 'a axis = (Obj .const , 'a ) C.Axis .t
2214
+
2215
+ type error = Error : 'a axis * 'a Solver .error -> error
2212
2216
2213
2217
type equate_error = equate_step * error
2214
2218
@@ -2338,33 +2342,35 @@ module Value_with (Areality : Areality) = struct
2338
2342
2339
2343
type lr = (allowed * allowed ) t
2340
2344
2341
- type ('a, 'd0, 'd1) axis =
2342
- | Monadic : (Monadic.Const .t , 'a ) Axis .t -> ('a , 'd , 'd neg ) axis
2343
- | Comonadic : (Comonadic.Const .t , 'a ) Axis .t -> ('a , 'd , 'd pos ) axis
2345
+ module Axis = struct
2346
+ type ('a, 'd0, 'd1) t =
2347
+ | Monadic : (Monadic.Const .t , 'a ) Axis .t -> ('a , 'd , 'd neg ) t
2348
+ | Comonadic : (Comonadic.Const .t , 'a ) Axis .t -> ('a , 'd , 'd pos ) t
2344
2349
2345
- type axis_packed = P : (_ , _ , _ ) axis -> axis_packed
2350
+ type packed = P : (_ , _ , _ ) t -> packed
2346
2351
2347
- let print_axis (type a d0 d1 ) ppf (axis : (a, d0, d1) axis ) =
2348
- match axis with
2349
- | Monadic ax -> Axis. print ppf ax
2350
- | Comonadic ax -> Axis. print ppf ax
2352
+ let print (type a d0 d1 ) ppf (t : (a, d0, d1) t ) =
2353
+ match t with
2354
+ | Monadic ax -> Axis. print ppf ax
2355
+ | Comonadic ax -> Axis. print ppf ax
2356
+
2357
+ let all =
2358
+ [ P (Comonadic Areality );
2359
+ P (Monadic Uniqueness );
2360
+ P (Comonadic Linearity );
2361
+ P (Monadic Contention );
2362
+ P (Comonadic Portability );
2363
+ P (Comonadic Statefulness );
2364
+ P (Monadic Visibility ) ]
2365
+ end
2351
2366
2352
- let lattice_of_axis (type a d0 d1 ) (axis : (a, d0, d1) axis ) :
2367
+ let lattice_of_axis (type a d0 d1 ) (axis : (a, d0, d1) Axis.t ) :
2353
2368
(module Lattice with type t = a ) =
2354
2369
match axis with
2355
2370
| Comonadic ax -> Comonadic.Const. lattice_of_axis ax
2356
2371
| Monadic ax -> Monadic.Const. lattice_of_axis ax
2357
2372
2358
- let all_axes =
2359
- [ P (Comonadic Areality );
2360
- P (Monadic Uniqueness );
2361
- P (Comonadic Linearity );
2362
- P (Monadic Contention );
2363
- P (Comonadic Portability );
2364
- P (Comonadic Statefulness );
2365
- P (Monadic Visibility ) ]
2366
-
2367
- let proj_obj : type a d0 d1. (a, d0, d1) axis -> a C.obj = function
2373
+ let proj_obj : type a d0 d1. (a, d0, d1) Axis.t -> a C.obj = function
2368
2374
| Monadic ax -> Monadic. proj_obj ax
2369
2375
| Comonadic ax -> Comonadic. proj_obj ax
2370
2376
@@ -2604,29 +2610,29 @@ module Value_with (Areality : Areality) = struct
2604
2610
let monadic = Monadic. min in
2605
2611
merge { comonadic; monadic }
2606
2612
2607
- let print_axis : type a. (a, _, _) axis -> _ -> a -> unit =
2613
+ let print_axis : type a. (a, _, _) Axis.t -> _ -> a -> unit =
2608
2614
fun ax ppf a ->
2609
2615
let obj = proj_obj ax in
2610
2616
C. print obj ppf a
2611
2617
2612
- let le_axis : type a d0 d1. (a, d0, d1) axis -> a -> a -> bool =
2618
+ let le_axis : type a d0 d1. (a, d0, d1) Axis.t -> a -> a -> bool =
2613
2619
fun ax m0 m1 ->
2614
2620
match ax with
2615
2621
| Comonadic ax -> Comonadic. le_axis ax m0 m1
2616
2622
| Monadic ax -> Monadic. le_axis ax m0 m1
2617
2623
2618
- let min_axis : type a d0 d1. (a, d0, d1) axis -> a = function
2624
+ let min_axis : type a d0 d1. (a, d0, d1) Axis.t -> a = function
2619
2625
| Comonadic ax -> Comonadic. min_axis ax
2620
2626
| Monadic ax -> Monadic. min_axis ax
2621
2627
2622
- let max_axis : type a d0 d1. (a, d0, d1) axis -> a = function
2628
+ let max_axis : type a d0 d1. (a, d0, d1) Axis.t -> a = function
2623
2629
| Comonadic ax -> Comonadic. max_axis ax
2624
2630
| Monadic ax -> Monadic. max_axis ax
2625
2631
2626
- let is_max : type a d0 d1. (a, d0, d1) axis -> a -> bool =
2632
+ let is_max : type a d0 d1. (a, d0, d1) Axis.t -> a -> bool =
2627
2633
fun ax m -> le_axis ax (max_axis ax) m
2628
2634
2629
- let is_min : type a d0 d1. (a, d0, d1) axis -> a -> bool =
2635
+ let is_min : type a d0 d1. (a, d0, d1) Axis.t -> a -> bool =
2630
2636
fun ax m -> le_axis ax m (min_axis ax)
2631
2637
2632
2638
let split = split
@@ -2677,7 +2683,7 @@ module Value_with (Areality : Areality) = struct
2677
2683
let monadic, b1 = Monadic. newvar_below monadic in
2678
2684
{ monadic; comonadic }, b0 || b1
2679
2685
2680
- type error = Error : ('a , _ , _ ) axis * 'a Solver .error -> error
2686
+ type error = Error : ('a , _ , _ ) Axis .t * 'a Solver .error -> error
2681
2687
2682
2688
type equate_error = equate_step * error
2683
2689
@@ -2715,7 +2721,7 @@ module Value_with (Areality : Areality) = struct
2715
2721
2716
2722
let proj :
2717
2723
type a l0 l1 r0 r1 .
2718
- (a , l0 * r0 , l1 * r1 ) axis -> (l0 * r0 ) t -> (a , l1 * r1 ) mode =
2724
+ (a , l0 * r0 , l1 * r1 ) Axis. t -> (l0 * r0 ) t -> (a , l1 * r1 ) mode =
2719
2725
fun ax m ->
2720
2726
match ax with
2721
2727
| Monadic ax -> proj_monadic ax m
@@ -2735,7 +2741,7 @@ module Value_with (Areality : Areality) = struct
2735
2741
2736
2742
let max_with :
2737
2743
type a l0 l1 r0 r1 .
2738
- (a , l0 * r0 , l1 * r1 ) axis -> (a , l1 * r1 ) mode -> (disallowed * r0 ) t =
2744
+ (a , l0 * r0 , l1 * r1 ) Axis. t -> (a , l1 * r1 ) mode -> (disallowed * r0 ) t =
2739
2745
fun ax m ->
2740
2746
match ax with
2741
2747
| Monadic ax -> max_with_monadic ax m
@@ -2755,7 +2761,7 @@ module Value_with (Areality : Areality) = struct
2755
2761
2756
2762
let min_with :
2757
2763
type a l0 l1 r0 r1 .
2758
- (a , l0 * r0 , l1 * r1 ) axis -> (a , l1 * r1 ) mode -> (l0 * disallowed ) t =
2764
+ (a , l0 * r0 , l1 * r1 ) Axis. t -> (a , l1 * r1 ) mode -> (l0 * disallowed ) t =
2759
2765
fun ax m ->
2760
2766
match ax with
2761
2767
| Monadic ax -> min_with_monadic ax m
@@ -2771,7 +2777,7 @@ module Value_with (Areality : Areality) = struct
2771
2777
2772
2778
let join_with :
2773
2779
type a l0 l1 r0 r1 .
2774
- (a , l0 * r0 , l1 * r1 ) axis -> a -> (l0 * r0 ) t -> (l0 * r0 ) t =
2780
+ (a , l0 * r0 , l1 * r1 ) Axis. t -> a -> (l0 * r0 ) t -> (l0 * r0 ) t =
2775
2781
fun ax c m ->
2776
2782
match ax with
2777
2783
| Monadic ax -> join_with_monadic ax c m
@@ -2787,7 +2793,7 @@ module Value_with (Areality : Areality) = struct
2787
2793
2788
2794
let meet_with :
2789
2795
type a l0 r0 l1 r1 .
2790
- (a , l0 * r0 , l1 * r1 ) axis -> a -> (l0 * r0 ) t -> (l0 * r0 ) t =
2796
+ (a , l0 * r0 , l1 * r1 ) Axis. t -> a -> (l0 * r0 ) t -> (l0 * r0 ) t =
2791
2797
fun ax c m ->
2792
2798
match ax with
2793
2799
| Monadic ax -> meet_with_monadic ax c m
@@ -2922,7 +2928,7 @@ module Const = struct
2922
2928
}
2923
2929
2924
2930
module Axis = struct
2925
- let alloc_as_value : Alloc.axis_packed -> Value.axis_packed = function
2931
+ let alloc_as_value : Alloc.Axis.packed -> Value.Axis.packed = function
2926
2932
| P (Comonadic Areality) -> P (Comonadic Areality )
2927
2933
| P (Comonadic Linearity) -> P (Comonadic Linearity )
2928
2934
| P (Comonadic Portability) -> P (Comonadic Portability )
@@ -2973,7 +2979,7 @@ module Modality = struct
2973
2979
| Meet_with : 'a -> 'a raw
2974
2980
| Join_with : 'a -> 'a raw
2975
2981
2976
- type t = Atom : ('a , _ , _ ) Value .axis * 'a raw -> t
2982
+ type t = Atom : ('a , _ , _ ) Value.Axis .t * 'a raw -> t
2977
2983
2978
2984
let is_id (Atom (ax , a )) =
2979
2985
match a with
@@ -2994,7 +3000,7 @@ module Modality = struct
2994
3000
module Monadic = struct
2995
3001
module Mode = Value. Monadic
2996
3002
2997
- type 'a axis = ( Mode.Const .t , 'a ) Axis .t
3003
+ type 'a axis = 'a Mode .axis
2998
3004
2999
3005
type error = Error : 'a axis * 'a raw Solver .error -> error
3000
3006
@@ -3149,7 +3155,7 @@ module Modality = struct
3149
3155
module Comonadic = struct
3150
3156
module Mode = Value. Comonadic
3151
3157
3152
- type 'a axis = ( Mode.Const .t , 'a ) Axis .t
3158
+ type 'a axis = 'a Mode .axis
3153
3159
3154
3160
type error = Error : 'a axis * 'a raw Solver .error -> error
3155
3161
@@ -3307,7 +3313,8 @@ module Modality = struct
3307
3313
end
3308
3314
3309
3315
module Value = struct
3310
- type error = Error : ('a , _ , _ ) Value .axis * 'a raw Solver .error -> error
3316
+ type error =
3317
+ | Error : ('a , _ , _ ) Value.Axis .t * 'a raw Solver .error -> error
3311
3318
3312
3319
type equate_error = equate_step * error
3313
3320
@@ -3358,7 +3365,7 @@ module Modality = struct
3358
3365
let to_list { monadic; comonadic } =
3359
3366
Comonadic. to_list comonadic @ Monadic. to_list monadic
3360
3367
3361
- let proj (type a d0 d1 ) (ax : (a, d0, d1) Value.axis )
3368
+ let proj (type a d0 d1 ) (ax : (a, d0, d1) Value.Axis.t )
3362
3369
{ monadic; comonadic } =
3363
3370
match ax with
3364
3371
| Monadic ax -> Monadic. proj ax monadic
0 commit comments