Why it matters
Type classes underlie most Scala libraries. Understanding shapes library design + use.
Advertisement
The architecture
Trait: Show[A] with 'def show(a: A): String'.
Instances: implicit vals per type.
Use: 'def print[A](a: A)(implicit s: Show[A])'.
Advertisement
How it works end to end
Derivation: automatic instance generation for case classes (Circe, ScalaCheck).
Scala 3: 'given' keyword replaces implicit. Cleaner.
Coherence: only one instance per type + type class.