Data Types Are Cheap
As I said at the outset (and will say again), all we did here was to identify the kinds of data we had in the problem domain, and what kinds of transformations we wanted to perform on it, and then we built up the data structures and the code to do the transformations.
Let’s look at the tools that modern functional languages provide for doing this.
The first “tool” is the sheer flexibility for declaring new data types and the scope for reusing them. This is very important: rather than encoding some data in a hash and hoping that you remember to keep the encoding consistent, Haskell allows—even encourages—you to add a new type that expresses exactly what you want to store. Such type declarations are much shorter than the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access