TDNR without new operators or syntax changes

AntC anthony_clayden at clear.net.nz
Sat May 28 10:13:43 UTC 2016


> Evan Laforge <qdunkan <at> gmail.com> writes:

> ... what would happen if you tried to do records
> just like C structs?  So e.g. a•b requires 'a' to be a record with a
> 'b' field, and is just one identifier, no functions involved, and 'b'
> is not a separate value.

Hi Evan, um, that's the original TDNR isn't it?
http://hackage.haskell.org/trac/haskell-prime/wiki/
TypeDirectedNameResolution
As per Jeremy's ref in the first post in this thread.

If you're talking C then that blobby thing between a and b
should be a dot(?) as postfix operator.
And it is an operator, not "just one identifier".

Then if you intend that dot bind tighter than function apply,
but not as tight as Module name prefixes,
you have the original TDNR.

If you intend some operator symbol other than dot,
there's a risk existing code is already using it,
and/or it's not ASCII.
And you're introducing an operator with very non-standard binding rules.
(The reason SPJ chose dot, apart from that following other languages,
 is there's already a precedent for it being tight-binding in Module prefixes.)

> 
> I didn't see that option on the increasingly all-encompassing
> Records wiki page.
> 

It's linked as Solution 2 on that records page, called "TDNR".

Surely there can't be any records approaches that haven't been aired by now?
And GHC's direction is set.


AntC


More information about the Glasgow-haskell-users mailing list