Skip to content

Commit

Permalink
Merge pull request #345 from sideeffffect/master
Browse files Browse the repository at this point in the history
add getOrFailF function to Option
  • Loading branch information
forki authored Sep 9, 2016
2 parents d22d8cb + 237a90a commit 573c817
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FSharpx.Extras/ComputationExpressions/Monad.fs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ module Option =
| Some x -> x
| None -> failwith m

/// Gets the value associated with the option or print to a string buffer and raise an exception with the given result. Helper printers must return strings.
let inline getOrFailF fmt =
function
| Some x -> x
| None -> failwithf fmt

/// Gets the value associated with the option or raises the supplied exception.
let inline getOrRaise e =
function
Expand Down

0 comments on commit 573c817

Please sign in to comment.