TDNR without new operators or syntax changes

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sat May 21 15:14:19 UTC 2016


AntC wrote:
> > 
> > With syntaxless TDNR enabled, the last line could be:
> > 
> >     f b c = do { reset b; reset c }
> > 
> 
> Heck, I didn't think you meant something that radical.
> So bare name in a function application context is to need disambiguating.
> 
> I think you'll find rather a lot of those in existing code.
> So this is a code-breaking change.

I don't understand your conclusion.

The code above, in context, is currently illegal: There are two "reset"
functions in scope, and the compiler will ask the programmer to specify
which of them they intended to use.

Jeremy's proposal, I believe, is that the compiler should pick /the/
possibility that type-checks (f had a type signature that would allow
only one combination to work); . Note that this has nothing to do with
record fields at all, except that they give rise to a compelling use
case.

(I'm not endorsing the proposal, just trying to clarify what it is.)

Cheers,

Bertram



More information about the Glasgow-haskell-users mailing list