o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o john, with no particular reference to haskell, but just generically speaking, this sounds vaguely similar to what i worked on all through the 80's in lisp and pascal, when ut-lisp used to pull a hal 9k about cyclic d-structures so i had to start redoing everything from scratch on my own recognizance in turbo pascal, no really. vide my recent, very slow attempts to document this work at my inquiry list: http://stderr.org/pipermail/inquiry/ http://stderr.org/cgi-bin/mailman/listinfo/inquiry here are the anchors of some pertinent threads: http://stderr.org/pipermail/inquiry/2003-March/000100.html -- exposition http://stderr.org/pipermail/inquiry/2003-March/000115.html -- source code http://stderr.org/pipermail/inquiry/2003-March/000120.html -- commentary http://stderr.org/pipermail/inquiry/2003-March/000141.html -- motivation it may be another year or so before i can finish (or even get back to) the te deums of documentality, but if anybody is remotely tantalized i will do my level best to explain what's going on there. jon awbrey o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o
Message: 10 Date: Thu, 12 Jun 2003 19:02:55 -0700 From: John Meacham <john@repetae.net> Subject: a dream of databases To: haskell@haskell.org
so, I have been wanting to implement serialize to database functionality for haskell in a certain way which may or may not be possible..
what would be nice is if I could dump an entire complex haskell data structure (perhaps cyclic, but not infinite) to a hash-table database (like berkeley db). pointers would be swizzled into hash keys and each haskell thunk would become an entry in the database.
loading the database would return the haskell structure just as it was put into the database but it would be demand loaded. meaning that evaluating a data thunk will actually grab that entry out of the database (like with lazy file reading) and entries that have not been accessed in a while would be transparently reclaimed by the garbage collector (and reloaded later if needed)
And of course, these haskell data structures should be albe to be arbitrary and would look no different from other haskell data structures. they would just have appropriate instances derived for them by DrIFT (or perhaps template haskell).
now. I am pretty sure I can do the demand loading bit with some goddawful code (inspired by HOODs internals) using unsafePerformIO and Weak pointers in truly nefarious ways. The dumping to the database bit is straightforward when working with trees. but I can't figure out a way to do it for potentially complex datastructures. perhaps someone out there has an idea? perhaps some template haskell tricks can be pulled to make it happen? I realize that any solution will be quite hacky and unlikely to be very portable.
John
--------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net --------------------------------------------------------------------------- o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o