HaskellDB
Simon Peyton-Jones
simonpj@microsoft.com
Mon, 3 Feb 2003 11:02:45 -0000
Funnily enough, I'm currently ruminating on the possibility of adding
extensible records to GHC. My current thought is: much like TRex,
except with 'has' predicates instead of 'lacks' predicates. That would
give
polymorphic field selection and update
but not polymorphic record extension
So the main thing you *wouldn't* be able to do, that TRex can handle is:
f :: (r\l) =3D> {r} -> {r | l::Int}
f x =3D {x | l =3D 3}
Main reason: I'd like to translate records into tuples in the
intermediate language, and polymorphic extension is problematic. =20
On the other hand, you *could* do all the other things TRex supports,
such as
f :: (r has l::Int) =3D> r -> Int
f x =3D x.l
f :: (r has l::Int) =3D> r -> r
f x =3D x { l <- 3 }
(Syntax uncertain.)
Question: does anyone really care about polymorphic extension.
Sorry that this message is a bit brief; I'm just back from a week away.
I can elaborate if anyone would be interested.
Simon
| -----Original Message-----
| From: Dominic Steinitz [mailto:dominic.steinitz@blueyonder.co.uk]
| Sent: 26 January 2003 10:19
| To: libraries@haskell.org
| Cc: daan@cs.uu.nl
| Subject: HaskellDB
|=20
| Having used HToolkit successfully to extract information from a MySQL
| database, I am painfully aware of the limitations of sending embedded
SQL
| strings and finding out at runtime that something didn't quite work
(in an
| often subtle and difficult to track down way).
|=20
| I'd love to be able to put HaskellDB on top of HToolkit. There are two
| approaches: i) add extensible records to ghc or ii) modify HaskellDB
so it
| uses Haskell records not extensible records (I'd have modify HaskellDB
| anyway to use HToolkit rather than talk to ODBC directly). The latter
sounds
| as though it might be more feasible that the former. Having read the
paper
| and briefly looked at the code, I assume the extensibility is required
if
| you have two tables each with the same column name and therefore you
want to
| use the same label in two different records. Obviously you can't do
this
| with Haskell records as the labels become top level functions.
However, if I
| rename labels then I won't have this problem. For example, if I have
two
| tables, passwd and notify each containing a column called email then I
could
| have labels notifyEmail and passwdEmail and remember that they really
| referred to email.
|=20
| Does anyone have any views on this?
|=20
| Dominic Steinitz
|=20
| _______________________________________________
| Libraries mailing list
| Libraries@haskell.org
| http://www.haskell.org/mailman/listinfo/libraries