Status of OverloadedRecordFields [Was: Re: Proposal: Dot as Postfix Function Apply]

Adam Gundry adam at well-typed.com
Thu Nov 5 09:03:00 UTC 2015


[copying ghc-devs as the following is perhaps more relevant there]

On 04/11/15 10:44, Jeremy wrote:
> Dot as Postfix Function Apply
> (https://ghc.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix)
> was originally part of ORF, but dropped to keep the scope/discussion more
> manageable. Now that ORF is in for GHC 8.0, I would like to re-propose dot
> postfix syntax.

I'm going to stay out of the discussion over the proposed syntax
extension, but I feel like I should do some expectation management about
ORF in GHC 8.0. As the wiki page [1] makes clear, ORF has been divided
into three components, and so far only one of these is in GHC HEAD.

The first part is a language extension, DuplicateRecordFields, which
allows field names to be duplicated provided they are unambiguous. (It
does not allow any kind of polymorphism over record fields.) This is
already in HEAD.

The second part is another language extension, OverloadedLabels, which
introduces a new syntax #x for an identifier whose type is inferred and
may depend on the text of the identifier. This is implemented and up on
Phabricator [2], but not yet in HEAD. It should make GHC 8.0, but I'm
wary about giving cast-iron guarantees.

The third part, which is necessary for the OverloadedLabels syntax to be
used for polymorphism over record fields, involves typeclass constraints
that capture when a type has a particular field, with the instances
provided automatically by GHC. This is not yet implemented in the
intended form, and is unlikely to make GHC 8.0 (barring me having a
sudden outbreak of free time...).

Adam


[1] https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields
[2] https://phabricator.haskell.org/D1331

-- 
Adam Gundry, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/


More information about the ghc-devs mailing list