simple extension to ghc's record disambiguation rules

AntC anthony_clayden at
Mon Feb 20 01:21:45 CET 2012

>Hi, I'd like to propose an extremely simple extension to ghc's record 
>disambiguation rules, 

I wonder if John is teasing us? Nothing wrt to records is simple (IMHO).

John seems to be unaware of the threads on 'Records in Haskell' (ghc-users)
or 'Type-Directed Name Resolution' (cafe) that have been storming for the
last few months.

He refers to a web page ...
> ideally it would be combined with the 'update' and 'label-based 
> pattern-matching' extensions from this page 

... which is several years old, requesting features that have been largely
delivered in
ghc's -XDIsambiguateRecordFields, -XNamedFieldPuns, and -XRecordWildCards.

> my motivation is that I often have record types with multiple constructors 
> but common fields. 

Perhaps this is a different requirement to those threads above?
Most are dealing with the namespacing problem of common fields in different
record types.
I think John means common fields under different constructors within the
same type(?).

> so, my proposal is that when you come across something like 

> (e::RecType) { blah = foo } 

> (with an explicit type signature like shown) 

It's certainly an innovation to go looking for an explicit type sig. within
an expression.
Does anything else in Haskell do that?

> It ... would be a new thing 
> for patterns which generally don't allow type signatures there. 

> It sidesteps type checker interactions by only being triggered when an 
> explicit type annotation is included. 

>    John 

"Extremely simple"? I don't think so.

I've added a suggested approach to approximate what John is asking for to my
DORF proposal.
-- as a **speculative** **future** development.

The ease with which I could do that (both a polymorphic record update _and_
polymorphic record pattern match) suggests my proposal is powerful enough to
achieve the limited aims for the namespacing issue, with some headroom. --
But then I would say that, wouldn't I!

(By the way, none of the 'Records in Haskell' proposals describe themselves
as "extremely simple".


View this message in context:
Sent from the Haskell - Glasgow-haskell-users mailing list archive at

More information about the Glasgow-haskell-users mailing list