title: Difference between composition and function application
body: <p>The first problem in <a href="http://www.haskell.org/haskellwiki/99_questions/1_to_10" rel="nofollow">99 Haskell Problems</a> is to "find the last element of a list". I came up with two solutions:</p>
  
  <p><strong>Solution 1 (This works)</strong></p>
  
  <pre><code>myLast :: [a] -&gt; a
  myLast = head . reverse
  </code></pre>
  
  <p><strong>Solution 2 (This doesn't work)</strong></p>
  
  <pre><code>myLast :: [a] -&gt; a
  myLast = head $ reverse
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <ul>
  <li>Why does solution 1 work but not solution 2? What I'm most confused by is how neither implementations supply pattern matching.</li>
  </ul>