[Haskell-cafe] The difference between ($) and application
Derek Elkins
ddarius at hotpop.com
Tue Dec 14 13:49:57 EST 2004
> On Mon, Dec 13, 2004 at 07:49:00PM -0800, oleg at pobox.com wrote:
> > The operator ($) is often considered an application operator of a
> > lower precedence. Modulo precedence, there seem to be no difference
> > between ($) and `the white space', and so one can quickly get used
> > to treat these operators as being semantically the same. However,
> > they are not the same in all circumstances. I'd like to observe an
> > important case where replacing the application with ($) in a
> > fully-parenthesized expression can lead to a type error.
>
> I think this post should go under the heading "($) considered
> harmful". I've been bitten by this, and I never use ($) anymore in
> place of parentheses because it's too tempting to think of it as
> syntax. (Of course, it's still useful, by itself or in a slice, as a
> higher-order operator.)
>
> Andrew
I find this position ridiculous. I don't recall anyone ever posting a
message about this (though I'd be far from surprised if someone did).
It seems that the people who decide they need higher-rank types are
capable of handling type errors involving them, and they certainly
don't confuse ($) for syntax. Unless there's a realistic scenario where
one suddenly decides one needs some higher-rank types and has to remove
a bunch of uses of ($) but otherwise make no changes, I don't see any
reason not to use ($) when you can (if you like) and not when you can't.
If you ever make a mistake one way the type checker will tell you.
More information about the Haskell-Cafe
mailing list