From: Justin B. <jgb...@gm...> - 2009-05-27 18:01:47
|
On Tue, May 26, 2009 at 10:44 PM, Artyom Shalkhakov <art...@gm...> wrote: > At the moment, one has to provide a DB specification in terms > of Database.HaskellDB.DBSpec, and the boilerplate code is generated > automagically with DB/Direct. HaskellDB-TH on the other hand provides > programmer with TH-specific functions while I think it would be much > better if these functions operated over DB/Direct specifications: you give > it a specification to get your boilerplate, as simple as that. > Cool idea! I don't have time to do it right now but I like it. It's a great opportunity to learn template haskell if you want to get a patch together :) > > I wanted to create a database table exclusively through HaskellDB; don't > tell me I'm mad, please. :) > Another good idea but I think something that falls outside haskellDB. You can create your own type-level info that represents what you want, though. You could use that along with a HaskellDB table definition to create the table w/ additional constraints. This paper on CoddFish, "Strong Types for Relational Databases (Functional Pearl)" by Alexandra Silva and Joost Visser, has a great tutorial on type-level programming in the first two sections, worth reading if you want to go that route: http://www.di.uminho.pt/~joostvisser/publications/StrongTypesForRDBs.pdf Justin |