title: How to use custom version of List: `data List a = Nil | Cons a (List a)`?
body: <p>This question is based on an example from the chapter <em>&quot;Declaring Types and Classes&quot;</em> of the book <em>&quot;Programming in Haskell&quot;</em> by Graham Hutton, <em>second edition</em>.</p>
  <p>The data declaration is:
  <code>data List a = Nil | Cons a (List a)</code></p>
  <p>The example function that uses this declaration is:</p>
  <pre><code>len :: List a -&gt; Int
  len Nil = 0
  len (Cons _ xs) = 1 + len xs
  </code></pre>
  <p>But no matter what I've tried, I can't seem to use the function <code>len</code>:</p>
  <ul>
  <li><code>len Cons 1 Cons 2 Cons 3</code></li>
  <li><code>len 1</code></li>
  <li><code>len Cons</code></li>
  <li><code>len (1)</code></li>
  <li><code>len [1,2]</code></li>
  <li><code>len Cons [1]</code></li>
  <li><code>len (1,2)</code></li>
  <li><code>len Cons (1,2)</code></li>
  <li><code>len Cons 1 2</code></li>
  <li><code>len (Cons (1,2))</code></li>
  <li><code>len (Cons 1 2)</code></li>
  </ul>
  <p>Did I miss out any permutation of <code>len</code> and <code>Cons</code>?  Or is the example simply unworkable?</p>