Chapter 3. Designing functional domain models

This chapter covers

  • Designing domain models—the functional and algebraic way
  • Decoupling the algebra of the domain from its implementation
  • Enforcing the laws of algebra in designing APIs
  • Implementing lifecycle patterns of domain objects

Previous chapters covered the parallels between functional programming and mathematics in general, and algebra in particular. You explored algebraic data types, sum types, and product types, and you learned how to combine them to form abstractions that model your domain elements. This chapter takes this discussion to the next level; you’ll begin with specifications of the model and, using algebraic composition of types, build APIs for our domain model. These ...

Get Functional and Reactive Domain Modeling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.