[Haskell-cafe] Substitute for records?

Mattias Bengtsson moonlite at dtek.chalmers.se
Mon Apr 10 15:38:14 EDT 2006


Currently i'm working, together with a friend, on an abstraction (sort
of) of HaskellDB for a school-project.
Basically we are generating haskell-modules similar to those generated
by DBDirect in HaskellDB together with some helpers for the most common
queries you'd want to run.
HaskellDB has its own record system (HDBRec) and a HaskellDB-query also
returns such a record. The accessor-functions for these records can
later be found in DatabaseName.TableName.ColumnName.column. These should
be imported qualified to avoid name clashes.
This is some example code:

  students <- School.Students.all db
  mapM_ printStudentId students

  printStudentId rec = print $ rec!School.Students.Id.column

The main problem for me here is this part:
  rec!School.Students.Name.column
where i would rather just write 
  rec!id 
This isn't possible and the other way is just too messy for my taste. It
simply isn't the easy and nice syntax i had hoped for when we started to
develop this.
Are there any other nice substitutes for HDBRec or normal haskell
records that i could use that doesn't make name clashes an issue?

Mattias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060410/55838cd9/attachment.bin


More information about the Haskell-Cafe mailing list