[Haskell-cafe] The difference between ($) and application
Derek Elkins
ddarius at hotpop.com
Tue Dec 14 15:00:18 EST 2004
> Derek Elkins wrote:
> >Andrew Pimlott wrote:
> >>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.
> >
> >I find this position ridiculous. [...] If you ever make a mistake
> >one way the type checker will tell you.
>
> For what it's worth, this is not true in the presence of implicit
> parameters:
>
> f :: ((?p :: Int) => Int) -> Int
> f g = let ?p = 1 in g
>
> x,y :: Int
> x = let ?p = 2 in (f ?p) ==> 1
> y = let ?p = 2 in (f $ ?p) ==> 2
>
> I wouldn't mind ($) being magical, along the lines of the magical
> runST in a rank-1 type system. It would be nice to be able to use it
> in patterns too.
>
> -- Ben
Moral of the story, and if I'm not mistaken, in your opinion, is not to
use implicit parameters (as currently formulated). I.e. the
consensus seems to be that this is implicit parameters' fault not ($)'s.
Personally, I would mind ($) being magical. One of the nice things
about Haskell is there is practically no magic. The last thing I want
is Haskerl (http://www.dcs.gla.ac.uk/~partain/haskerl.html). runST
simply had a rank-2 type that is not expressible in Haskell 98, it seems
getting ($) to "work" would be qualitatively different.
More information about the Haskell-Cafe
mailing list