January 2018
Beginner to intermediate
312 pages
7h 22m
English
Now that we’ve seen how to implement validateOrder, we can use the same techniques to build the rest of the pipeline functions.
Here’s the original design of the pricing step function, with effects:
| | type PriceOrder = |
| | GetProductPrice // dependency |
| | -> ValidatedOrder // input |
| | -> Result<PricedOrder, PlaceOrderError> // output |
But again, we’ll eliminate the effects for now, leaving this design:
| | type GetProductPrice = ProductCode -> Price |
| | type PriceOrder = |
| | GetProductPrice // dependency |
| | -> ValidatedOrder // input |
| | -> PricedOrder // output |
And here’s the outline of the implementation. It simply transforms each order line to a PricedOrderLine and builds a new PricedOrder with them:
| |
Read now
Unlock full access