On Fri, 5 Sep 2003, Johannes Waldmann wrote: > On Thu, 4 Sep 2003, John Hughes wrote: > > > I use Haskell and Wash/CGI for administering students lab work. > > same here (in addition to Haskell programs for actually grading the homework). > > just curious: what kind of data base do you use? > we take Krasimir Angelov's MySql binding (from HToolkit). > > this has the advantage that the administrator > can directly view/edit the data base > via the sql shell resp. via webmin. >
I wrote a very simple database implementation in Haskell, which stores and fetches Showable Haskell values with an associated key. The interface is very simple: just getRecord :: Key k r => k -> IO (Maybe r) putRecord :: Key k r => k -> r -> IO () where the instance of the Key class determines where the records are stored. Advantages: * Trivial interface * No need to worry about configuring any other software * Very quick to implement * Can store most kinds of Haskell data * I can directly view/edit the database with emacs! Disadvantages: * Must handle locking myself * No transactions, so no rollback on failure * Leads to a "network style", where records explicitly contain the keys of related records. * Must maintain invariants such as "if A points to B then B points to A" myself. * Performance is poor, but... With 170 students the amount of data involved is small, and with each accessing the system a few dozen times over a period of weeks, this isn't a performance critical application. I know this isn't the "right" way to do it, but it was quick, easy, and it works pretty well. John _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell