map3

JobResultOption.map3

Namespace: FsToolkit.ErrorHandling

Function Signature:

('a -> 'b -> 'c -> 'd)
  -> Job<Result<'a option, 'e>>
  -> Job<Result<'b option, 'e>>
  -> Job<Result<'c option, 'e>>
  -> Job<Result<'d option, 'e>>

Examples

Note: Many use-cases requiring map3 can also be solved using the jobResultOption computation expression.

Example 1

Given the following functions:

getUserById : UserId -> Job<Result<User option, exn>>
getPostById : PostId -> Job<Result<Post option, exn>>
getCommentById : CommentId -> Job<Result<Comment option, exn>>

And a combining function:

let combine user post comment = (user, post, comment)

We can combine all three using JobResultOption.map3:

Last updated