[Haskell-cafe] Some thoughts on Type-Directed Name Resolution

Kevin Quick quick at sparq.org
Wed Feb 1 08:16:31 CET 2012



On Tue, 31 Jan 2012 23:10:34 -0700, Anthony Clayden  
<anthony_clayden at clear.net.nz> wrote:
> I'm proposing x.f is _exactly_ f x. That is, the x.f gets
> desugared at an early phase in compilation.

Anthony,

I think part of the concern people are expressing here is that the above  
would imply the ability to use point-free style.  But this orthogonality  
is disavowed by your exception:

> A 'one-sided dot doesn't mean anything.

I haven't read the underlying proposals, so I apologize if the following  
is covered, but my understanding of the discussion is that the x.f  
notation is intended to disambiguate f to be a field name of the type of x  
and therefore be advantageous over "f x" notation where f is presently in  
the global namespace.

With your exception, I still cannot disambiguate the following:

data Rec = { foo :: String }

foo :: Rec -> String
foo = show

rs :: [Rec]
rs = [ ... ]

bar = map foo rs

If the exception doesn't exist, then I could write one of the following to  
clarify my intent:

bar = map foo rs
baz = map .foo rs


-- 
-KQ



More information about the Haskell-Cafe mailing list