diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-10-09 01:16:35 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-10-09 01:16:35 -0300 |
| commit | 254d106c92dcabcdeb83a5d0141deca22ffb79de (patch) | |
| tree | c99478aed6730365fcdd907b7bd777e3b7e2237a /lib/protocols/Admission.ml | |
| parent | 4896005e5d156e8a590b12946a54507daa895686 (diff) | |
| download | RNT-254d106c92dcabcdeb83a5d0141deca22ffb79de.tar.gz RNT-254d106c92dcabcdeb83a5d0141deca22ffb79de.zip | |
admission protocol for multigroup denial checks
Diffstat (limited to 'lib/protocols/Admission.ml')
| -rw-r--r-- | lib/protocols/Admission.ml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/protocols/Admission.ml b/lib/protocols/Admission.ml new file mode 100644 index 0000000..5a20105 --- /dev/null +++ b/lib/protocols/Admission.ml @@ -0,0 +1,21 @@ +module Error = struct + open Concepts.Condition + + let not_admitting () = + condition "not-admitting" "A handle was expected to carry the admission protocol and did not" + empty +end + +type violations = (string * Concepts.Tuple.t list) list + +class type implementation = object + method check : (violations, Concepts.Condition.condition) result +end + +type Handle.protocol += Admission of implementation +type t = implementation + +let make impl = Admission (impl :> implementation) +let from handle = Handle.into handle (function Admission impl -> Some impl | _ -> None) +let require handle = from handle |> Option.to_result ~none:(Error.not_admitting ()) +let check i = Handle.invoke i (fun o -> o#check) |
