title: Why does Haskell's showList function return ShowS
body: <p>I am trying to create a type for simple key/value pairs, that can be converted to a URL query. So I created the following ADT:</p>
  
  <pre><code>data Target where
      (:=&gt;) :: String -&gt; String -&gt; Target
  
  instance Show Target where
      show (a :=&gt; b) = a ++ "=" ++ b
      showList (xs) = (\y -&gt; intercalate "&amp;" $ map show xs)
  </code></pre>
  
  <p>When I run it in ghci it works exactly how I want:</p>
  
  <pre><code>ghci&gt;["id" :=&gt; "123", "color" :=&gt; "red"]
  id=123&amp;color=red
  it :: [Target]
  </code></pre>
  
  <p>My question is: Why do I need the lambda in <code>showList</code>?  I tried to <code>show y</code> and it just prints an empty string.  What is the purpose of returning a <code>ShowS</code> when the argument is just empty? Or maybe a better question, to what is the <code>showS</code> function applied in this case?</p>