bind

AsyncResult.bind

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

Examples

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

Example 1

Continuing from the AsyncResult.map2 example and given the function
let notifyFollowers : NotifyNewPostRequest -> Async<Result<unit,exn>>
we can notify all followers using AsyncResult.bind as below:
newPostRequestResult |> AsyncResult.bind notifyFollowers