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

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Tue Dec 14 14:27:51 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
 >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 

    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

More information about the Haskell-Cafe mailing list