klequis / zz-haskell-notebook

Notes from learning Haskell
1 stars 0 forks source link

Derived instances #49

Open klequis opened 2 years ago

klequis commented 2 years ago

In Haskell, we have derived instances so that obvious or common type classes, such as Eq, Enum, Ord, and Show can have their instances generated based solely on how a datatype is defined. Programmers can make use of these conveniences without writing the code themselves, over and over.

klequis commented 2 years ago

HPFFP p.171: Deriving means you don't have to manually write instances of these type classes for each new datatype you create. Further info to come in chapter 11.