Haskell Language Type Classes


Typeclasses in Haskell are a means of defining the behaviour associated with a type separately from that type's definition. Whereas, say, in Java, you'd define the behaviour as part of the type's definition -- i.e. in an interface, abstract class or concrete class -- Haskell keeps these two things separate.

There are a number of typeclasses already defined in Haskell's base package. The relationship between these is illustrated in the Remarks section below.


The following diagram taken from the Typeclassopedia article shows the relationship between the various typeclasses in Haskell.

Relationships among standard Haskell type classes, Figure 1 as published in Typeclassopedia.