Heterogenous Data in Haskell
So far in this book, you’ve learned how to use polymorphism to create data structures and functions that can work with many different types. In all of the examples you’ve worked through so far, you’ve had to select a single type for any given instance of a polymorphic type. For example, while you can create a list that can hold any type, once instantiated, that list is restricted to only holding values of that one specific type that you selected.
In some cases, having data structures that are restricted to being uniform in the type they can hold can be quite inconvenient. In these situations, we turn to heterogenous data structures, which can hold values from an arbitrary collection of types. One particularly common ...
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