title: Why does ($ 3) have signuature (a -> b) -> b?
body: <p>In <em>Learn you a Haskell</em>, it is given the following example:</p>
  <pre><code>map ($ 3) [(4+), (10*), (^2), sqrt]
  [7.0,30.0,9.0,1.7320508075688772]  
  </code></pre>
  <p>However, I don't understand why this works.</p>
  <p>The signatures of the functions are</p>
  <pre><code>Prelude&gt; :info ($)
  ($) :: (a -&gt; b) -&gt; a -&gt; b
  Prelude&gt; :t ($ 3)
  ($ 3) :: Num a =&gt; (a -&gt; b) -&gt; b
  </code></pre>
  <p>However, <code>-&gt;</code> is a left-associative operator, so <code>$ :: (a -&gt; b) -&gt; a -&gt; b</code> is actually <code>((($ :: (a-b))-&gt; a)-&gt; b)</code>, so shouldn't <code>3</code> in <code>($ 3)</code> correspond to <code>(a-&gt;b)</code> function that is the first &quot;variable&quot; of the function <code>$</code>? i.e why is <code>($ 3)</code> a function of signature <code>(a -&gt; b) -&gt; b</code></p>
  <p>Source: <a href="http://learnyouahaskell.com/higher-order-functions" rel="nofollow noreferrer">http://learnyouahaskell.com/higher-order-functions</a></p>