Description
I am trying to use this function
|
let inline getOrFailF fmt = |
|
function |
|
| Some x -> x |
|
| None -> failwithf fmt |
but it seems to me that it does not do what I expect it to do... consider this snippet that fails to compile:
let x = Some 1
let _ = x |> Option.getOrFailF "asdf %b" true // error FS0001: Type mismatch. Expecting a 'int option -> 'a' but given a 'bool -> 'b'
let _ = x |> (Option.getOrFailF ("asdf %b" true)) // error FS0003: This value is not a function and cannot be applied
My question is - is this an expected behaviour of this function? How should I use it correctly?
I know there is a workaroud like that:
let _ = x |> Option.getOrFail (sprintf "asdf %b" true)
but I wanted to avoid writing sprintf, hence the question.
Pinging @sideeffffect
Description
I am trying to use this function
FSharpx.Extras/src/FSharpx.Extras/ComputationExpressions/Monad.fs
Lines 236 to 239 in 0c34475
but it seems to me that it does not do what I expect it to do... consider this snippet that fails to compile:
My question is - is this an expected behaviour of this function? How should I use it correctly?
I know there is a workaroud like that:
let _ = x |> Option.getOrFail (sprintf "asdf %b" true)but I wanted to avoid writing
sprintf, hence the question.Pinging @sideeffffect