Creating Sum Types

Records are a useful feature of Haskell’s type system, and you’ll use them regularly in the code you write, but they are just a small part of the power of types in Haskell. In this section, you’ll learn about several other useful features of Haskell’s type system, which broadly fall under the term algebraic datatypes, or ADTs.

The name algebraic datatype comes from the formal study of types and type systems. We won’t get into the details of the name or the underlying theory in this book, but we’ll continue to use the term, along with some related terms like sum type and product type when we’re referring to particular types of features. These are commonly used terms when working with Haskell, but you can learn what they mean ...

Get Effective Haskell 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.