Proposal: Dot as Postfix Function Apply

Dominique Devriese dominique.devriese at cs.kuleuven.be
Fri Nov 6 08:31:28 UTC 2015


2015-11-05 9:21 GMT+01:00 Jules Bean <jules at jellybean.co.uk>:
>> The fact that it may conflict
>> with previous, less natural syntax choices (lens composition with .
>> comes to mind) should not be counted against an opt-in extension.
>
> Lens composition with (.) is not really a syntax choice - Lens composition with (.) is simply function composition with (.) which is a fairly deeply-set Haskell choice. I can see arguments against using (.) for function composition but I don’t think anyone would seriously consider changing that now: and Lens composition will always have the same syntax as function composition.
>
> It just so happens that Lens composition with (.) gives us the ability to write person^.job.title which is one of those nice coincidences which looks a bit like C-style object dereference.

This coincidence is nice because it approximates expectations from
other languages.  Unfortunately, this approximation breaks down
quickly in only slightly more complex cases like `func
person^.job.title`, "person^.someFuncProperty someArgument" and
doesn't extend to writing `person.job.title`, leading (imho) to
confusion and an unnatural feel.

Also, I'm not sure why there's a "vote" about this now.  As someone
already mentioned, no community approval is needed to *first*
implement it in some way (perhaps using ghc-reskin as suggested by
someone), experiment with it and see if it makes as much sense as some
of us expect.

Regards,
Dominique


More information about the Libraries mailing list