Skip to content

Instantly share code, notes, and snippets.

@jhewlett
Last active December 18, 2018 19:47
Show Gist options
  • Save jhewlett/eeb2d2c23dd1681af92aa3d979971ae8 to your computer and use it in GitHub Desktop.
Save jhewlett/eeb2d2c23dd1681af92aa3d979971ae8 to your computer and use it in GitHub Desktop.
Independent authorization checks
let firstCheckResult () : Result<unit, NotAuthorized> =
match firstCheck () with
| Some c when c.CanRead -> Ok ()
| _ -> Error NotAuthorized
let secondCheckResult () : Result<unit, NotAuthorized> =
match secondCheck () with
| Some c when c.CanRead -> Ok ()
| _ -> Error NotAuthorized
let thirdCheckResult () : Result<unit, NotAuthorized> =
match thirdCheck () with
| Some c when c.CanRead -> Ok ()
| _ -> Error NotAuthorized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment