title: Arrows tutorial teaser
body: <p>I can't understand the code from the <a href="https://wiki.haskell.org/Arrow_tutorial#A_Teaser" rel="nofollow noreferrer">teaser in the HaskellWiki arrows tutorial</a>:</p>
  
  <pre><code>main :: IO ()
  main = do
      let
          prepend x = arr (x ++)
          append  x = arr (++ x)
          withId  t = returnA &lt;+&gt; t
          xform = (withId $ prepend "&lt;") &gt;&gt;&gt;
                  (withId $ append "&gt;") &gt;&gt;&gt;
                  (withId $ ((prepend "!") &gt;&gt;&gt; (append "!")))
          xs = ["test", "foobar"] &gt;&gt;= (runKleisli xform)
      mapM_ putStrLn xs
  </code></pre>
  
  <p>where</p>
  
  <pre><code>   (withId f) &gt;&gt;&gt; (withId g) =
     (returnA &lt;+&gt; f) &gt;&gt;&gt; (returnA &lt;+&gt; g) =
     ((arr id) &lt;+&gt; f) &gt;&gt;&gt; ((arr id) &lt;+&gt; g)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>   ((id . id) x) ++ ((id . f) x) ++ ((id . g) x) ++ ((g . f) x) =
     x ++ (f x) ++ (g x) ++ ((g . f) x)
  </code></pre>
  
  <p>In the last two lines I can't figure out where exactly the distributive proprieties of composition (.) come from</p>