PROPOSAL: Include record puns in Haskell 2011

Iavor Diatchki iavor.diatchki at
Fri Feb 26 14:06:02 EST 2010


In order to keep the discussion structured I have created two tickets
in the haskell-prime trac system
  * Proposal 1: Add pre-Haskell'98 style punning and record
disambiguation (ticket #136)
  * Proposal 2: Add record-wildcards (ticket #137)

I decided to split the two into separate tickets because, at least in
my mind, there are different things that we might discuss about the
two, and also they make sense independent of each other (although
record wildcards without punning might be a bit weird :-).

I think that both proposals are worth considering for Haskell 2011
because there are situations where they can significantly improve the
readability of code involving record manipulation.  I disagree with
the stylistic issues that were brought up in the discussion because I
do not believe that variable "shadowing" should be avoided at all
costs:  at least for me, avoiding shadowing is a means to an end
rather then an end in itself.  In the case of record puns, I think
that the clarity of the notation far surpasses any confusion that
might be introduced by the shadowing.  Furthermore, as other
participants in the discussion pointed out, the proposed features are
orthogonal to the rest of the language, so their use is entirely


On Fri, Feb 26, 2010 at 2:59 AM, Heinrich Apfelmus
<apfelmus at> wrote:
> Simon Marlow wrote:
>> While I agree with these points, I was converted to record punning
>> (actually record wildcards) when I rewrote the GHC IO library.  Handle
>> is a record with 12 or so fields, and there are literally dozens of
>> functions that start like this:
>>   flushWriteBuffer :: Handle -> IO ()
>>   flushWriteBuffer Handle{..} = do
>> if I had to write out the field names I use each time, and even worse,
>> think up names to bind to each of them, it would be hideous.
> What about using field names as functions?
>    flushWriteBuffer h@(Handle {}) = do
>        ... buffer h ...
> Of course, you always have to drag  h  around.
> Regards,
> Heinrich Apfelmus
> --
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at

More information about the Haskell-prime mailing list