Last updated 3 years ago
Namespace: FsToolkit.ErrorHandling
FsToolkit.ErrorHandling
Function Signature:
('a -> 'b) -> Async<Result<'a option, 'c>> -> Async<Result<'b option, 'c>>
Note: Many use-cases requiring map operations can also be solved using .
map
Given the function
getUserById : UserId -> Async<Result<User option, exn>>
Then using the AsyncResultOption.map we can get the name of the user like this:
AsyncResultOption.map
// Async<Result<PersonName option>, exn> getUserById sampleUserId |> AsyncResultOption.map (fun user -> user.Name)
asyncResultOption