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!
- non-destructive-update Haskell DBMS (can use a
relational database without escaping to the IO
- supports user defined types
- supports user defined relations and functions
- command pattern structure for write-ahead logging
- Inner,Outer,Left,Right joins on arbitrary
(user-defined) relations (not just “=”)
- in-memory/in-process means no disk/marshalling overhead
- functions/aggregates not yet implemented e.g.
(a<b+c) or (a<max(b))
- no performance testing — joins expensive!
- no proof of correctness
- written by non-academic new haskell developer
- Not SQL. No Sockets. — should be part of the
app wrapper used to maintain consistency!
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