[Haskell-cafe] Re: functional database queries

apfelmus at quantentunnel.de apfelmus at quantentunnel.de
Thu Feb 22 09:33:55 EST 2007

Henning Thielemann wrote:
>> In other words, 'Query a' just assembles a valid SQL-string,
>> it does not query or execute anything.
> Of course, instead of the DSEL approach "don't execute anything, only
> construct a program in a foreign language which does that" it would be
> nice to have a database where Haskell is the native query language,
> allowing to access the database content with 'map', 'filter' and so on.

Yes, though this is most probably infeasible: unrestricted
lambda-calculus queries are disallowed for reasons of computability and

Of course, you can still conceive a DSEL offering 'map' and 'filter',
it's just that these will not be the known Haskell functions then. As
far as I see, the main point for 'Query a' being a monad is that you
need 'concatMap' == '>>=' to express table joins. After all, accessing
databases just means general list comprehensions.


More information about the Haskell-Cafe mailing list