Restaurants and sequenceS
Explore how to manage parallel reservations for hotels and restaurants in a TypeScript app using fp-ts's sequenceS function. Learn to combine Option types for optional data, implement structured parallel tasks, and update the reservation retrieval logic for enhanced functionality.
We'll cover the following...
Overview
Now, consider another scenario. When someone makes a reservation for a hotel, they can also make a reservation for a restaurant at the same time. When we call our Retrieve Lambda, we expect to get back both the hotel and optionally the restaurant. Yes, this is another scenario that merely serves as an excuse to show something from fp-ts.
In that case, we’d have to change our Retrieve to get both items, preferably in parallel. We’ll assume that our type for a restaurant reservation looks like this:
It’s quite similar to a hotel reservation, except that there’s a free drink string, ...