1
2
3
4
5
6
7
8
9
10
11
12
open Base
type guard = bool * string
let authorize (can, msg) = if can then Ok () else Error msg
let any guards msg =
let can =
guards |> List.map ~f:authorize |> List.find ~f:Result.is_ok
|> Option.is_some
in
authorize (can, msg)