A typeclass is a set of behaviors that can be attached to types and allow you to work at a much higher level of abstraction. While in languages such as Haskell typeclasses are a first class citizen, Scala doesn’t offer support for typeclasses with a keyword, but they can be implemented using implicits and context bounds. A vast number of libraries, including the standard library, use them extensively. For example, using typeclasses, you can write a single function that transforms `List[Option[A]]` into `Option[List[A]]`, `List[Try[A]]` into `Try[List[A]]`, and works with any other type that implements the same typeclass, without rewriting the function itself.
In this talk, we’ll learn what’s a typeclass, when to use them and how to implement them, look at some examples and figure out how to do more with less code!
A basic knowledge of Scala syntax is recommended to get the most out of this talk.
Session Category : Talk