Operators
Namespace:
FsToolkit.ErrorHandling.Operator.JobResult
FsToolkit.ErrorHandling provides the standard infix operators for the
map
(<!>
), apply
(<*>
), and bind
(>>=
) functions of the Job<Result<_,_>>
type.notifyFollowers : NotifyNewPostRequest -> Job<Result<unit, exn>>
We can then rewrite the example and additionally call
notifyFollowers
using the operators as below:open FsToolkit.ErrorHandling.Operator.JobResult
// CreatePostRequest -> Job<Result<unit, exn>>
let createPostAndNotifyFollowers (req : CreatePostRequest) =
notifyNewPostRequest
<!> (getFollowerIds req.UserId)
<*> (createPost req)
>>= notifyFollowers
Last modified 1yr ago