Skip to content

Commit 573c817

Browse files
authored
Merge pull request #345 from sideeffffect/master
add getOrFailF function to Option
2 parents d22d8cb + 237a90a commit 573c817

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • src/FSharpx.Extras/ComputationExpressions

src/FSharpx.Extras/ComputationExpressions/Monad.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ module Option =
232232
| Some x -> x
233233
| None -> failwith m
234234

235+
/// 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.
236+
let inline getOrFailF fmt =
237+
function
238+
| Some x -> x
239+
| None -> failwithf fmt
240+
235241
/// Gets the value associated with the option or raises the supplied exception.
236242
let inline getOrRaise e =
237243
function

0 commit comments

Comments
 (0)