Reputation: 7861
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
.
Upvotes: 4
Views: 871
Reputation: 10624
Option.map
does exactly what you need.
intOption |> Option.map int64
Upvotes: 3
Reputation: 6223
The function you're looking for is Option.map
:
let longOption = Option.map int64 intOption
Upvotes: 3