Do you need to persistently store your Haskell data types in tables ? Or just persistently store them ?
happstack-state provides the latter for you. Your data-types are just plain-old Haskell data types and your queries and updates are just functions in the Reader or State monad. It provides ACID properties with write-ahead logging to the disk, S3, or other backends. It also includes data-type versioning and automatic migration. Although it is associated with the happstack web application framework, there is nothing web specific about it. It does not even require that you build or install any of the web stuff in Happstack. To get a quick feel for how it works, I recommend this tutorial: http://nhlab.blogspot.com/2008/07/extending-asterisk-with-happs.html It is a little out of date -- but mostly you just need to change the imports from HAppS to Happstack. - jeremy On Sat, Sep 25, 2010 at 2:31 PM, Jonathan Geddes <geddes.jonat...@gmail.com> wrote: > Cafe, > > HaskellDB takes a database schema and produces Haskell data structures > (plus some other query-related stuff for its EDSL query language). > > What I'm looking for is the inverse of this functionality. I want to > create tables based on a Haskell data structure with a few simple > rules. These rules include: if a field is not of the form `Maybe a' > then it can't be nullable in the database. If a field is not a > primitive (in the database) then it is actually stored in another > table and a reference id is stored in the table. Tables are produced > recursively, unless they already exist, etc. > > The HaskellDB approach is great for interfacing with existing tables, > but in my case I already have data structures and now I would like a > quick way to create tables to persist them. > > Does such a thing exist? If not, would you find it useful? I may take > this up as a side project if it does not already exist and others > would find it useful. > > Thanks, > > --Jonathan > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe