[Haskell-cafe] Status of TypeDirectedNameResolution proposal?

Simon Peyton-Jones simonpj at microsoft.com
Wed Nov 18 05:10:39 EST 2009


It's always tempting to spend a lot of time on syntax, but in this case it may be justified.  Syntactic brevity is a good part of the point of TDNR.  And I'm on a train which is a good time to argue about syntax.

Personally I think there are strong advantages to ".":

 * For record selectors, currently written (x r), writing r.x is exactly right
 * For these unary operators, r.x really does mean (abstractly) "select the x field from r"
 * And that is the way that "." is used for modules: "M.x" means "select the x
   function from module M"
 * You can think of qualified names for modules in the same way "Control.Monad" means
   pick the Monad module from the Control group.
 * It culturally fits with the way "." is used on OO languages

What is the disadvantage?  Well, Haskell already uses "." for composition.  But

 * "." is already special.  If you write M.x you mean a qualified name, not the
   composition of data constructor M with function x

I merely propose to make it even special-er!   I'll keep quiet about syntax now.

Simon

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-
| bounces at haskell.org] On Behalf Of wren ng thornton
| Sent: 18 November 2009 03:07
| To: Haskell Cafe
| Subject: Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?
| 
| Neil Brown wrote:
| > Having skimmed the page, it seems like the re-use of "." is one of the
| > major difficulties of the proposal.  Would it be possible to use "->"?
| > It has been used for accessing members in C and C++, so it is not too
| > unusual a choice.
| 
| It's also the one that Perl went with.
| 
| 
| > It is already special in Haskell so it wouldn't break
| > anyone's code -- but do its other uses (case statements and lambdas)
| > mean that it would cause problems in the grammar if re-used for TDNR?
| 
| Given the other uses of -> in Haskell, I'm hesitant to suggest it
| either. I seem to recall # is the option used by OCaml and a few other
| functional-OO languages. So far as I know -XMagicHash is the only thing
| that would conflict with that name so it seems far less invasive than .
| or ->. Another option would be to use @ which is currently forbidden in
| expressions, though that might cause issues with System F/Core.
| 
| --
| Live well,
| ~wren
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list