map
Namespace:
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 the asyncResultOption
computation expression.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:// Async<Result<PersonName option>, exn>
getUserById sampleUserId
|> AsyncResultOption.map (fun user -> user.Name)
Last modified 1yr ago