Created
December 19, 2018 23:00
-
-
Save mikhailshilkov/baa1e6fec15dea2e8b867bafdf61f0e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WishList -> Async<Reservation> | |
let workflow (wishlist: WishList) = async { | |
// 1. Find matches for each wish | |
let! matches = | |
wishlist.Wishes | |
|> List.map findMatchingGift | |
|> Async.Parallel | |
// 2. Pick one product from the combined list of matches | |
let gift = pickGift (List.concat matches) | |
// 3. Register and return the reservation | |
let reservation = { Kid = wishlist.Kid; Product = gift } | |
do! reserve reservation | |
return reservation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment