Scoping monadic relational database queries
Paper in proceeding, 2019

We present a novel method for ensuring that relational database queries in monadic embedded languages are well-scoped, even in the presence of arbitrarily nested joins and aggregates. Demonstrating our method, we present a simplified version of Selda, a monadic relational database query language embedded in Haskell, with full support for nested inner queries. To our knowledge, Selda is the first relational database query language to support fully general inner queries using a monadic interface. In the Haskell community, monads are the de facto standard interface to a wide range of libraries and EDSLs. They are well understood by researchers and practitioners alike, and they enjoy first class support by the standard libraries. Due to the difficulty of ensuring that inner queries are well-scoped, database interfaces in Haskell have previously either been forced to forego the benefits of monadic interfaces, or have had to do without the generality afforded by inner queries.


Relational databases

Domain-specific languages



Anton Ekblad

Chalmers, Computer Science and Engineering (Chalmers), Functional Programming

Haskell 2019 - Proceedings of the 12th ACM SIGPLAN International Symposium on Haskell, co-located with ICFP 2019

978-1-4503-6813-1 (ISBN)

12th ACM SIGPLAN International Symposium on Haskell, Haskell 2019, co-located with ICFP 2019
Berlin, Germany,

Subject Categories

Language Technology (Computational Linguistics)


Information Studies



More information

Latest update