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
	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.


| -----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
| Having used HToolkit successfully to extract information from a MySQL
| database, I am painfully aware of the limitations of sending embedded
| strings and finding out at runtime that something didn't quite work
(in an
| often subtle and difficult to track down way).
| 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
| as though it might be more feasible that the former. Having read the
| and briefly looked at the code, I assume the extensibility is required
| 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
| 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
| tables, passwd and notify each containing a column called email then I
| have labels notifyEmail and passwdEmail and remember that they really
| referred to email.
| Does anyone have any views on this?
| Dominic Steinitz
| _______________________________________________
| Libraries mailing list
| Libraries@haskell.org
| http://www.haskell.org/mailman/listinfo/libraries