title: Haskell dot operator with sort and (++)
body: <p>I am learning haskell at the moment and trying to figure out all the rules of prefix, infix, precedence, etc.</p>
  <p>While trying to implement a function which appends two lists and sorts them I started with:</p>
  <pre><code>appendAndSort :: [a] -&gt; [a] -&gt; [a]
  appendAndSort = sort . (++)
  </code></pre>
  <p>which does no compile.</p>
  <p>Following:</p>
  <pre><code>appendAndSort :: Ord a =&gt; [a] -&gt; [a] -&gt; [a]
  appendAndSort = (sort .) . (++)
  </code></pre>
  <p>on the other hand does work.</p>
  <p>Why do I have to add a second dot at sort and parentheses around it?</p>