FsToolkit.ErrorHandling
Search…
README
Result
Option
ResultOption
AsyncResult
TaskResult
JobResult
List
AsyncResultOption
map
map2
map3
apply
bind
ignore
Computation Expression
Operators
Validation
Test
Powered By
GitBook
bind
AsyncResultOption.bind
Namespace:
FsToolkit.ErrorHandling
Function Signature:
(
'a
->
Async
<
Result
<
'b option
,
'c
>>
)
->
Async
<
Result
<
'a option
,
'c
>>
->
Async
<
Result
<
'b option
,
'c
>>
Examples
Note: Many use-cases requiring
bind
can also be solved using
the
asyncResultOption
computation expression
.
Example 1
Given the following functions:
getUserById
:
UserId
->
Async
<
Result
<
User option
,
exn
>>
getPostById
:
PostId
->
Async
<
Result
<
Post option
,
exn
>>
We can get a post's user given a
PostId
like this:
// Async<Result<Post option, exn>>
getPostById postId
|>
AsyncResultOption
.
bind
(
fun
post
->
getUserById post
.
UserId
)
Previous
apply
Next
ignore
Last modified
9mo ago
Copy link
Outline
AsyncResultOption.bind
Examples