In this recipe, you will learn about type classes. The type classes provide a common behavior across data types. In this way, a type class abstracts the common behavior and can be implemented by a variety of data. One can relate type classes to interface in C# or C++.
So far, whenever we defined data types we derived the data types from the Show type class without providing any explicit implementation for the type. In such cases, the default implementation is provided by GHC. In this recipe, we will provide explicit implementation for the standard Haskell type classes Show, Read, Enum, Eq, and Ord.