January 2018
Beginner to intermediate
312 pages
7h 22m
English
In our original design, we didn’t only use an error effect (Result). In most of the pipeline, we also used an async effect as well. Combining effects can be tricky in general, but since these two effects often appear together, we’ll define an asyncResult computation expression to go along with the AsyncResult type we defined earlier. We won’t show the implementation now, but you can find it in the code repository for this book.
Using asyncResult is just like using result. For example, the validateOrder implementation looks like this:
| | let validateOrder : ValidateOrder = |
| | fun checkProductCodeExists checkAddressExists unvalidatedOrder -> |
| | asyncResult { |
| | let! orderId = |
| | unvalidatedOrder.OrderId |
| | |> OrderId.create ... |
Read now
Unlock full access