Is there better way how to do this? :
let intOption = Some(123)
let longOption = match intOption with
| Some x -> Some(int64 x )
| None -> None
I need to convert option of int to option of int64.
Option.map does exactly what you need.
intOption |> Option.map int64
The function you're looking for is Option.map:
let longOption = Option.map int64 intOption
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With