Skip to Content
Effective Haskell
book

Effective Haskell

by Rebecca Skinner
July 2023
Intermediate to advanced
670 pages
17h 13m
English
Pragmatic Bookshelf
Content preview from Effective Haskell

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.
Start your free trial

You might also like

Grokking Functional Programming

Grokking Functional Programming

Michal Plachta
Grokking Algorithms

Grokking Algorithms

Aditya Bhargava
The Rust Programming Language, 2nd Edition

The Rust Programming Language, 2nd Edition

Steve Klabnik, Carol Nichols

Publisher Resources

ISBN: 9798888650400Errata Page