TDNR without new operators or syntax changes

AntC anthony_clayden at clear.net.nz
Tue May 17 06:44:43 UTC 2016


> Jeremy <voldermort <at> hotmail.com> writes:

Hi Jeremy, I feel your frustration at the slow evolution of records proposals.
There are many reasons, including that there has been much debate
and little consensus.

>
> Previous attempts to propose TDNR [1] have met with opposition over the
> accompanying proposal to change the syntax of the dot or add a new operator
> for postfix application.
> 
> However, nothing about TDNR - other than certain motivating examples -
> actually requires changes to the syntax of Haskell or new operators. ...

You are possibly confusing parts of one records proposal
with parts of TDNR.
In https://ghc.haskell.org/trac/ghc/wiki/Records/
DeclaredOverloadedRecordFields/DotPostfix
dot as postfix function apply could indeed be dispensed with.
But that is not within a TDNR approach.

> TDNR could be implemented as an extension which just give GHC
> a new way of disambiguating function names, and nothing else.

No. For TDNR GHC needs some syntactic signal to trigger disambiguation.
The idea was the dot (or some other operator) says "here comes a field label".
Without that signal, all GHC can see is a name 
-- could be a variable, a function, anything.

> 
> I would therefore like to propose TNDR without any syntax/prelude changes.
> 

I suspect that if you took the syntax away from TDNR,
you'd have very little left.

If there were a feasible records approach which needed no syntax/prelude
changes, I rather think it would have been found by now.
In terms of what's available now, have you looked at
 the lens approaches or Nikita's recent Anonymous Records?
https://ghc.haskell.org/trac/ghc/wiki/Records/Volkov

Have you looked at what's coming very shortly in GHC v8.0?
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields
I suspect Part 1: Duplicate Record Fields
will go a long way towards disambinguating label names,
with only an occasional need for explicit type signatures.

How does that compare with TDNR minus syntax?


AntC





More information about the Glasgow-haskell-users mailing list