I think the main aspect of typeclasses is defining common behavior for a set of types. In this playful example we have a set of character type belonging to the class Playable. Players have a healing power so the class reflects that. The example illustrates that the class instances can work differently from each other (warriors have a constant healing power, mages not).
I think the main aspect of typeclasses is defining common behavior for a set of types. In this playful example we have a set of character type belonging to the class
Playable
. Players have a healing power so the class reflects that. The example illustrates that the class instances can work differently from each other (warriors have a constant healing power, mages not).I hope you like the example.
In reference to issue #10.