How to Use Extensible Records in GHCi

Simon Peyton-Jones simonpj at
Tue Mar 30 08:34:23 EST 2004

No, extensible records are not implemented in GHC.  Hugs (or some
variant of it) implements TRex, another extensible record variant.  The
problem is that the record design space is large, and seems to lack
local optima.  And all reasonable variants break backward compatibility.
As a result, nothing much happens.

But for the particular code you write, H98 does the job fine:
data C = C { a :: Int, b:: Bool, c::Int, ... i::String}

Then if there's an expression e::C, you can write 
	e { b=True } 
to change the b component to True.  Check the H98 report


| -----Original Message-----
| From: glasgow-haskell-users-bounces at
| bounces at] On Behalf Of S. Alexander Jacobson
| Sent: 30 March 2004 00:14
| To: GHC users
| Subject: FAQ: How to Use Extensible Records in GHCi
| I feel like I have way too much code of the form:
|    changeGpart (C a b c d e f g h i) g' =
| 	C a b c d e f g' h i
| So, I got excited reading Simon and Mark's
| "Lightweight Extensible Records For Haskell" paper
| as a way to get rid of this cruft.  I immediately
| started GHCi, typed {a="Hello world"}, and got an
| error.
| Is the feature described in the paper just a
| proposal or is there a switch somethere to enable
| it?
| Alternatively, perhaps this code is a common
| beginner mistake due to ignorance of the proper
| idiom...
| -Alex-
| _________________________________________________________________
| S. Alexander Jacobson                  mailto:me at
| tel:917-770-6565             
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list