Que$\Lambda$: Finally, Type-Safe, Extensible and Efficient Language Integrated Query

We present the general platform-agnostic framework for extensible type-safe embedding of typed domain specific languages into a functional language that also lets us write and add transformations (optimization passes) on embedded programs. The transformation are guaranteed to be type-preserving and hygienic by their very construction. They can be built from separately developed and reusable parts and arbitrarily composed into optimization pipelines. Both the embedded language and the set of transformations are extensible; moreover, upon extending the language the unaffected transformations can apply as they are. The framework is built in the tagless-final approach, using its advantages and finding ways to overcome the fatal drawback of seeming impossibility to examine embedded expressions. We enjoy the convenience and the built-in hygiene of higher-order abstract syntax and still able to safely and assuredly examine and transform the bodies of abstractions.

QueL is embedded by the framework as a relational query language that covers Cheney et al.'s T-LINQ. The type-safe and composable embedded query language is transformed into the form from which the efficient SQL can be produced. The language and the optimizations can be safely extended to account for many variations in the SQL back-ends, as well for domain-specific knowledge.

Download

The current version is 0.2.1, Aug 25, 2015.
quel.tar.gz
Note on Aug 25, 2015: We have eliminated the unnecessary dependency to MetaOCaml. Now the code works with plain OCaml.

The current release can be obtained from the BitBucket repository.

Credits

The key developers of QueL are:
Kenichi Suzuki (ken @ logic.cs.tsukuba.ac.jp)
Oleg Kiselyov
Yukiyoshi Kameyama