Lesson 18. Parameterized types
After reading lesson 18, you’ll be able to
- Use parameterized types to make generic data types
- Understand kinds of types
- Write code using the Data.Map type to look up values
In this unit so far, we’ve discussed how types can be added and multiplied, like data. Like functions, types can also take arguments. Types take arguments by using type variables in their definitions (so their arguments are always other types). Types defined using parameters are called parameterized types. Parameterized types perform an important role in Haskell, as they allow you to define generic data structures that work with a wide range of existing data.
Suppose you want to create a type representing a pair ...
Get Get Programming with 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.