Easy Static Checking for Embedded DSLs in Scala with Contextual
Offered By: Scala Days Conferences via YouTube
Course Description
Overview
Explore compile-time checking for embedded domain-specific languages (DSLs) in Scala using the Contextual library in this Scala Days Copenhagen 2017 conference talk. Learn how to create string interpolators that perform parsing and validation at compile-time without writing macros. Discover techniques for implementing custom error messages and adding compile-time safety to Scala code. Dive into practical examples of creating literal-like types for email addresses, URLs, YAML, CSS, and even Haskell. Gain insights into the TyperAPI, extension methods, and the inner workings of Contextual. Follow along with demonstrations of various interpolators, including ObjectID, CSS, and XML examples. Understand how to leverage Contextual for parsing, validation, and creating custom literal types to enhance code safety and expressiveness in Scala projects.
Syllabus
Introduction
What is Contextual
Why Contextual interrupts are boring
The Typer
Why is it true
How does it work
Extension Methods
Revisiting Extension Methods
Contextual
Examples
Embedding in Scala
Writing Interpolators
Haskell
Regular Expressions
Use of Facing Messages
Contextual Interpolators
Object
ID
CSS Interpolator
A horrible abomination
XML
XML Example
Xylophone
compile error
check tags
embed name
preview
embed type class
check string content
assign context
pass position
create object
extension field
literals method
parses method
dissect URL
create case object
compile
substitution
input types
version number
Taught by
Scala Days Conferences
Related Courses
Design of Computer ProgramsStanford University via Udacity Programming Languages
University of Virginia via Udacity Data Structures and Performance
University of California, San Diego via Coursera Introducción a Data Science: Programación Estadística con R
Universidad Nacional Autónoma de México via Coursera Applied Text Mining in Python
University of Michigan via Coursera