Namespace: FsToolkit.ErrorHandling
Function Signature:
('a -> 'b) -> Task<Result<'a, 'c>> -> Task<Result<'b, 'c>>


Note: Many use-cases requiring map operations can also be solved using the taskResult computation expression.

Example 1

As a continuation of Result.map3 Example 2, let's assume that we want to store the created post in the database using the function
savePost : CreatePostRequest -> Task<Result<PostId, exn>>
We can save the post and return its inner using
let rawPostId : Task<Result<Guid, exn>> =
savePost createostRequest
|> (fun (PostId postId) -> postId)
Last modified 1yr ago