12

Building Better Containers – Functional Data Types

In Chapter 11, Implementing Design Patterns, we went over how to use functions to achieve different results. In this chapter, we will look at data types from a functional point of view. We’ll be considering how we can implement our own data types, along with several features that can help us compose operations or ensure their purity so that our FP coding will become simpler and shorter.

We’ll be touching on several topics:

  • Data types from a functional point of view. Even though JavaScript is not a typed language, a better understanding of types and functions is needed, to complement our usage of TypeScript.
  • Containers, including functors and the mystifying monads, to structure a data flow. ...

Get Mastering JavaScript Functional Programming - Third Edition 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.