Common type classes

In a typical project, you will not create many of your own type classes. Since type classes capture behaviors that are common across several types, it is likely that someone else has already implemented a type class similar to what you need, located in a library. It is usually more productive to reuse type classes defined in the SDK (or in third-party libraries) than to try and define your own.

In general, these libraries define predefined instances of a type class for the SDK types (String, Int, Option, and so on). You would typically reuse these instances to derive instances for your own types.

In this section, we will present the type classes that you are most likely to encounter, and how to use them to solve day-to-day programming challenges.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset