From: Justin B. <jgb...@gm...> - 2008-07-30 22:37:55
|
All, Attached you'll find a patch which adds several useful Template Haskell functions to haskelldb. They are not intended to be part of the base haskelldb install, so no new dependency on TH is introduced. Instead, they are in a haskelldb-th directory under the haskelldb source distribution, similar to how the driver files are distributed. Building and installing the package is easy: cd haskelldb-th runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs haddock runhaskell Setup.hs install Only one module is exported at this time - Database.HaskellDB.CodeGen. The functions exported are: mkField, mkFieldWithName, mkDBDirectField - Create compile-time field declarations with various levels of control over names. mkDBDirectTable, mkDBDirectTableWithName, mkDBDirectTableType -- Create compile-time table declarations and type synonyms, with various degrees of control over names or individual piece. mkRecord - Provides a simpler way to build projections from multiple tables and fields. Comments and suggestions welcome! If this patch is accepted, I will upload the package to hackage so it is available as a separate download. Of course, it depends on haskelldb 0.11, so that will need to be updated first. Justin p.s. haskelldb actually has some legacy functions in test/old/THField.hs that are similar to these, but I discovered those after I'd written mine, plus they aren't quite as robust. |