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

Donn Cave donn at avvanta.com
Tue Feb 7 02:08:19 CET 2012

Quoth AntC <anthony_clayden at clear.net.nz>,
> It was a surprise to me that dot without spaces around is still legal
> syntax for function composition.

It isn't even unusual.  You can find stuff like "fromIntegral.ord" in
packages downloaded to build cabal-install for example.  It graphically
appeals to the notion of a function composed of several functions, so
the programmers in question will likely not even be repentant!

It's hard to imagine this all going anywhere, really, without some
way around the code breakage.  Maybe a different separator, like
record\field, that really doesn't occur in infix like that.

> Are all pseudo- or virtual or calculated 'fields'. (Or if not fields, then 
> attributes or properties.)
> I presume you're not suggesting we have both a function `area' and a pseudo-
> field `.area'?

Well - there's no conflict between those two names, if `.area' is an
identifier that starts with a dot.  But virtual or calculated fields
would presumably not be supported.  Depends on whether it's legal to
define a function `.area', or `.' spelling is allowed only for declared
record fields.  Personally I think the latter would be the right choice
there - left of the dot must be a record value, right of the dot must
be a field declared for that record.  I understand this is not the
direction you're going.


More information about the Haskell-Cafe mailing list