bind

TaskResult.bind

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

Examples

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

Example 1

Continuing from the TaskResult.map2 example and given the function
let notifyFollowers : NotifyNewPostRequest -> Task<Result<unit,exn>>
we can notify all followers using TaskResult.bind as below:
newPostRequestResult |> TaskResult.bind notifyFollowers
Last modified 1yr ago