
Hi Justin, I updated my changes to apply against that repo, thanks for the pointer. Cool to see new changes to haskelldb, especially all the new unit tests! You can find my updated repo at: http://patch-tag.com/r/haskelldb-hlist Re-reading your email now, I see you asked for a patch, but seeing patch-tag for the first time I got excited and uploaded a whole new repo, whoops. Anyway, I had to do some minor surgery to update to the new version -- everything compiles, but I haven't tested much beyond that yet. Let me know if you have any questions. Thanks, -Brian
I like the direction you are going. I looked into using HList a year or so ago and I wasn't quite up to it. The latest (unreleased) version of HaskellDB is on patch-tag at http://patch-tag.com/r/haskelldb/snapshot/current/content/pretty. Would you mind creating a patch file against that for easier review? I won't commit it until you say its ready but I'd like to see what changes you have made.
No announcement has been made but I took over maintainership from Bjorn a few months ago. I hope to get a 1.0 release of HaskellDB out this summer, and having something new like this in it would be pretty sweet.
On Sat, May 16, 2009 at 3:08 PM, Brian Bloniarz
wrote: Hi,
It's come time to share something that I've been playing around with recently: a branch of HaskellDB which replaces the home-grown Record code with HList records. It's definitely not ready for primetime, but I thought it'd be a good time to post the code and solicit some feedback from the community.
HaskellDB the concept is very promising, but IMHO the code still falls short of that promise. Hopefully this is a small step in the right direction -- the advantages of using HList: * Shared implementation of extensible records * Additional features from HList * Better error messages for record misuse * "Lacks" predicates * Simpler code
As an example of how this can be better, a DB insert looks like so:
insert db table $ constantRecord $ film .=. "Munchie" .*. director .=. Just "Jim Wynorski" .*. emptyRecord The columns need not appear in the same order as in the database. If you forget a column, you'll get "error: No instance for (Fail (FieldNotFound (Proxy Director)))" rather than an opaque error. Using the new "insertOpt" function, Maybe
columns will default to Nothing rather than needing to be specified.
The details:
I haven't updated everything, but there's enough to run test/TestCases.hs under Postgresql. TestCases is probably the best place to look for examples of the new syntax for now.
HList had name conflicts with HaskellDB's SQL expression language ((.*.), (.++.), etc.) My temporary band-aid is to move the expression functions to Database.HaskellDB.SqlExpr, and require people to import qualified.
The Attr type is gone, columns labels are untyped now. I also replaced a few instances of primitive type-level recursion with HMap/HMapOut. This makes the code simpler, and the type signatures more complex -- type families would help a lot here, I think.
Feedback welcome! You can find my darcs tree at:
http://mysite.verizon.net/vzewxzuh/sitebuildercontent/sitebuilderfiles/haske... It also requires minor changes to HList, available at:
http://mysite.verizon.net/vzewxzuh/sitebuildercontent/sitebuilderfiles/hlist... I'll talk to the HList people about getting those merged.
Thanks!
Brian Bloniarz
________________________________ Hotmail® has a new way to see what's up with your friends. Check it out. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_________________________________________________________________ Hotmail® has ever-growing storage! Don’t worry about storage limits. http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutoria...