[Haskell-cafe] The difference between ($) and application

Andrew Pimlott andrew at pimlott.net
Tue Dec 14 00:47:47 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


More information about the Haskell-Cafe mailing list