A Relational DBMS in under 1000 lines of (Haskell) code!

In thinking about a data storage model for a web app I wanted to develop, and in finding Haskell so concise and expressive, I wondered if one could write a relational DBMS in Haskell in under 1000 lines of code. The answer appears to be yes!

Features:

non-destructive-update Haskell DBMS (can use a
relational database without escaping to the IO
monad!)

Not SQL. No Sockets. — should be part of the
app wrapper used to maintain consistency!

License: GPL

Note: I am an expert neither in Haskell, nor in
relational databases, nor in
relational algebra/set theory/category theory. So
comments/suggestions/recommendations on any aspect
of this code are welcome.

Comment on Haskell: WOW!!!!!! I basically wrote
this without testing just thinking about my
program in terms of transformations between types.
I wrote the test/example code at the end and had
almost no implementation errors in the code! The