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!) * 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 Risks include: * 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! * 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 compiler/type-system is really really good at preventing you from making coding mistakes! I've never in my life had a block of code this big work on the first try!!! I am WAYYY impressed. Note: Code working means doing what I think it will do. I might be wrong about relational theory, but that is a separate class of problem. -Alex- _________________________________________________________________ S. Alexander Jacobson mailto:me@alexjacobson.com tel:917-770-6565 http://alexjacobson.com