I have made an image processing module that defines a Pixel type as a Color and Location. Pixel, Color, and Location derive Eq, as I may want to compare pixels between multiple images.
Algebraic Data Types (ADTs) in Haskell can automatically become instances of some typeclasses (like Show, Eq) by deriving from them.
I\'ve been playing with newtype wrappers for my indexes to avoid 开发者_JAVA技巧bugs, and I have some code like this: