Join Newsletter

How Best to Blend a Domain-Specific Language into a Host Language?

YOW! 2013 Sydney

For the domain of databases, the old question of how to achieve language integrated query is receiving renewed attention, in part because of its support through Microsoft’s LINQ framework. We present a practical theory of language-integrated query based on quotation and normalisation of quoted terms. Higher-order features prove useful even for constructing first-order queries. We prove a theorem characterising when a host query is guaranteed to generate a single SQL query, and we present experimental results confirming our technique works, even in situations where Microsoft’s LINQ framework either fails to produce an SQL query or, in one case, produces an avalanche of SQL queries. Our ideas are implemented in F#, and the talk briefly considers how they might apply to other languages such as Scala and Haskell.