PROPOSAL: Include record puns in Haskell 2011

Simon Marlow marlowsd at
Wed Feb 24 15:50:42 EST 2010

On 24/02/10 18:23, Ian Lynagh wrote:
> On Tue, Feb 23, 2010 at 07:07:30PM -0800, Iavor Diatchki wrote:
>> I'd like to propose that we add record punning to Haskell 2011.
>> Thoughts, objections, suggestions?
> I have a feeling I'm in the minority, but I find record punning an ugly
> feature.
> Given
>      data T = C { f :: Int }
> we implicitly get
>      f :: T ->  Int
> which punning shadows with
>      f :: Int
> whereas I generally avoid shadowing completely.

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.

There are reasons to find this distasteful, yes, but I think the 
alternative is much worse.

I'm not proposing record wildcards (yet) *cough* labelled-field 
wildcards, but punning is a step in the right direction.


More information about the Haskell-prime mailing list