A talk given at Scala.UA 2016 in Kiev, Ukraine.
Scala combines a powerful type system with a lean but flexible syntax. This combination enables incredible flexibility in library design, most particularly in designing internal DSLs for many common scenarios: specification definition and matching in Specs² and ScalaTest, request routing in Spray and query construction in Squeryl, just to name a few. The budding DSL designer, however, will quickly realize that there are precious few resources on how to best approach the problem in Scala; the various techniques, limitations and workarounds are not generally well understood or documented, and every developer ends up running into the same challenges and dead-ends. In this talk I'll attempt to summarize what I've learned from reading, extending and designing Scala DSLs in the hopes that it'll save future Scala library designers a whole lot of pain.