aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Mode.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/concepts/Mode.ml')
-rw-r--r--lib/concepts/Mode.ml17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/concepts/Mode.ml b/lib/concepts/Mode.ml
index 23abacf..6ac1704 100644
--- a/lib/concepts/Mode.ml
+++ b/lib/concepts/Mode.ml
@@ -21,15 +21,16 @@ let generation declaration bound =
(fun tightest {bound= declared; affords} ->
match affords with
| Generates cardinality when BatSet.String.subset declared bound ->
- Some
- ( match tightest with
- | None -> cardinality
- | Some other -> Cardinality.meet cardinality other )
+ Some (Option.fold ~none:cardinality ~some:(Cardinality.meet cardinality) tightest)
| Generates _ | Decides -> tightest )
None declaration
+let exhaustible declaration bound =
+ Option.fold ~none:false ~some:Cardinality.exhaustible (generation declaration bound)
+
let decision declaration bound =
- List.exists
- (fun {bound= declared; affords} ->
- match affords with Decides -> BatSet.String.equal declared bound | Generates _ -> false )
- declaration
+ exhaustible declaration bound
+ || List.exists
+ (fun {bound= declared; affords} ->
+ match affords with Decides -> BatSet.String.equal declared bound | Generates _ -> false )
+ declaration