diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:23:40 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-23 03:23:40 -0300 |
| commit | b4422c99e10a8daee452b22aea84cb1f68ae54bc (patch) | |
| tree | 1f2ac50f4c536b8da83fca654cb3a6dee86a9975 /lib/concepts/Mode.ml | |
| parent | f88aeff9f7a673e945484a31fbcaed647bb3d2fa (diff) | |
| download | RNT-b4422c99e10a8daee452b22aea84cb1f68ae54bc.tar.gz RNT-b4422c99e10a8daee452b22aea84cb1f68ae54bc.zip | |
refactor ephemeral and subs relations
Diffstat (limited to 'lib/concepts/Mode.ml')
| -rw-r--r-- | lib/concepts/Mode.ml | 17 |
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 |
