Database Research Group

WSI – Database Systems Research Group

Algebraic Data Types for Language-Integrated Queries.

George Giorgidze, Torsten Grust, Alexander Ulrich, Jeroen Weijers

Proceedings of the 1st International Workshop on Data Driven Functional Programming (DDFP 2013), Rome, Italy. ACM, January 2013.

Online version

The seamless integration of relational databases and programming languages remains a major challenge. Mapping rich data types featured in general-purpose programming languages to the relational data model is one aspect of this challenge. We present a novel technique for mapping arbitrary (non-recursive) algebraic data types to a relational model, based on previous work on the relational representation of nested tables. Algebraic data types may be freely constructed and deconstructed in queries and may show up in the result type. The number of relational queries generated is small and statically determined by the type of the query. We have implemented the mapping in the Database Supported Haskell (DSH) library.