Abstract
You have seen how parametric polymorphism and higher-order functions help in the process of abstraction. In this chapter, I’ll introduce a new kind of polymorphism that sits in between parametric and the absence of polymorphism: ad hoc polymorphism. Using this feature, you can express that certain types exhibit a common behavior. Incidentally, you will also learn how Haskell makes it possible to use addition, (+), on different numeric types like Integer and Float while maintaining a strong type system.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
You can read the full Package Versioning Policy at pvp.haskell.org .
- 2.
The Haskell Platform is quite complete, so it also includes a type for complex numbers, which you can find in the Data.Complex module. This definition will be merely illustrative.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Alejandro Serrano Mena
About this chapter
Cite this chapter
Serrano Mena, A. (2019). Using Containers and Type Classes. In: Practical Haskell. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4480-7_4
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4480-7_4
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4479-1
Online ISBN: 978-1-4842-4480-7
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books