In the previous chapters, we explored the different tools and techniques available for doing type-driven development in ReasonML.
In this chapter, using a final example, we are going to develop a sense for when to use each type-driven technique to solve problems. Let's see how we could, at least partly, create code that handles input (within a small JavaScript app) for social, productivity, and business applications. To be precise, what we mean here are the kinds of successful applications, such as Gmail, Facebook, Twitter, Skype, Airbnb, or Uber, launched by Internet or platform companies.
In this chapter, we will cover the following topics:
- Starting with a variant type (version 1)
- Using more pattern matching (version 2)
- Switching to polymorphic variant types (version 3)
- Using records (version 4)
- Using modules for code structure (version 5)
- An alternative...