Have you seen a type signature like this before?
trait T[U <: T[U]]
F-bounded polymorphism (a.k.a self-referential types, recursive type signatures, recursively bounded quantification) is a powerful object-oriented technique that leverages the type system to encode constraints on generics.
Marconi Lanna explains how to define and use F-bounded types in Scala, enlisting the compiler to enforce advanced trait semantics, while greatly reducing and simplifying unit tests.
Further Resources
- Scala Training from ProTech
- Video & Tutorials on Scala