Understanding Higher Kinded Types and Polymorphism
You’ve seen that data and newtypes can accept type parameters, and even how those type parameters can be used polymorphically, for example, with the reverse function:
| reverse :: [a] -> [a] |
Types like this that accept type parameters are called higher kinded types. Higher kinded types are a powerful feature that differentiate Haskell types from the generics of many other popular languages. When combined with type classes, higher kinded types allow you to write highly generic and expressive code quickly and easily. In this section, you’ll learn how to make use of higher kinded types to write highly re-usable code, and how to make use of a new language extension, KindSignatures, to allow the ...
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.