title: Please confirm or correct my "English interpretation" of this Haskell code snippet
body: <p>I'm a C# developer who is working through <a href="http://book.realworldhaskell.org/" rel="noreferrer">"Real World Haskell"</a> in order to truly understand functional programming, so that when I learn F#, I'll really grok it and not just "write C# code in F#", so to speak.</p>
  
  <p>Well, today I came across an example which I thought I understood 3 different times, only to then see something I missed, update my interpretation, and recurse (and curse too, believe me).</p>
  
  <p>Now I believe that I do actually understand it, and I have written a detailed "English interpretation" below. Can you Haskell gurus please confirm that understanding, or point out what I have missed?</p>
  
  <p>Note: The Haskell code snippet (quoted directly from the book) is defining a custom type that is meant to be isomorphic to the built in Haskell list type.</p>
  
  <p><strong>The Haskell code snippet</strong></p>
  
  <pre><code>data List a = Cons a (List a)
                | Nil
                defining Show
  </code></pre>
  
  <p><strong><em>EDIT: After some responses, I see one misunderstanding I made, but am not quite clear on the Haskell "parsing" rules that would correct that mistake. So I've included my original (incorrect) interpretation below, followed by a correction, followed by the question that still remains unclear to me.</em></strong></p>
  
  <p><strong>EDIT: Here is my original (incorrect) "English interpretation" of the snippet</strong></p>
  
  <ol>
  <li>I am defining a type called "List".</li>
  <li>The List type is parameterised. It has a single type parameter.</li>
  <li>There are 2 value constructors which can be used to make instances of List. One value constructor is called "Nil" and the other value constructor is called "Cons".</li>
  <li>If you use the "Nil" value constructor, then there are no fields.</li>
  <li>The "Cons" value constructor has a single type parameter.</li>
  <li>If you use the "Cons" value constructor, there are 2 fields which must be provided. The first required field is an instance of List. The second required field is an instance of a.</li>
  <li>(I have intentionally omitted anything about "defining Show" because it is not part of what I want to focus on right now).</li>
  </ol>
  
  <p><strong>The corrected interpretation would be as follows (changes in BOLD)</strong></p>
  
  <ol start="8">
  <li>I am defining a type called "List".</li>
  <li>The List type is parameterised. It
  has a single type parameter.</li>
  <li>There are 2 value constructors
   which can be used to make instances
   of List. One value constructor is
   called "Nil" and the other value
   constructor is called "Cons". </li>
  <li><p>If you use the "Nil" value constructor, then there are no fields.</p>
  
  <p><strong>5. (this line has been deleted ... it is not accurate) The "Cons" value constructor has a single type parameter.</strong></p></li>
  <li><p><strong>If you use the "Cons" value constructor, there are 2 fields
   which must be provided. The first
   required field is an instance of a.
   The second required field is an
   instance of "List-of-a".</strong></p></li>
  <li>(I have intentionally omitted anything about "defining Show" because it is not part of what I want to focus on right now).</li>
  </ol>
  
  <p><strong>The question which is still unclear</strong></p>
  
  <p>The initial confusion was regarding the portion of the snippet that reads "Cons a (List a)". In fact, that is the part that is still unclear to me.</p>
  
  <p>People have pointed out that each item on the line after the "Cons" token is a <em>type</em>, not a value. So that means this line says "The Cons value constructor has 2 fields: one of type 'a' and the other of type 'list-of-a'."</p>
  
  <p>That is very helpful to know. However, something is still unclear. When I create instances using the Cons value constructor, those instances "interpret" the first 'a' as meaning "place the value passed in here." But they do <em>not</em> interpret the second 'a' the same way. </p>
  
  <p>For example, consider this GHCI session: </p>
  
  <pre><code>*Main&gt; Cons 0 Nil
  Cons 0 Nil
  *Main&gt; Cons 1 it
  Cons 1 (Cons 0 Nil)
  *Main&gt; 
  </code></pre>
  
  <p>When I type "Cons 0 Nil", it uses the "Cons" value constructor to create an instance of List. From 0, it learns that the type parameter is "Integer". So far, no confusion.</p>
  
  <p>However, it <em>also</em> determines that the <em>value</em> of the first field of the Cons is 0. Yet it determines <em>nothing</em> about the <em>value</em> of the second field ... it only determines that the second field has a <em>type</em> of "List Integer".</p>
  
  <p>So my question is, why does "a" in the first field mean "the type of this field is 'a' <em>and</em> the value of this field is 'a'", while "a" in the second field means <em>only</em> "the type of this field is 'List of a'"?</p>
  
  <p><strong>EDIT: I believe I have now seen the light, thanks to several of the responses. Let me articulate it here. (And if somehow it is <em>still</em> incorrect in some fashion, please by all means let me know!)</strong></p>
  
  <p>In the snippet "Cons a (List a)", we are saying that the "Cons" value constructor has two fields, and that the first field is of type 'a', and that the second field is of type 'List of a'.</p>
  
  <p><strong>That is all we are saying!</strong> In particular, we are saying <em>NOTHING</em> about values! This is a key point I was missing.</p>
  
  <p>Later, we want to create an instance, using the "Cons" value constructor. We type this into the interpreter: "Cons 0 Nil". This <strong>explicitly</strong> tells the Cons value constructor to use 0 for the value of the first field, and to use Nil as the value for the second field. </p>
  
  <p>And that's all there is to it. Once you know that the value constructor definition specifies <em>nothing but types</em>, everything becomes clear.</p>
  
  <p>Thanks everyone for the helpful responses. And as I said, if anything is still off, please by all means tell me about it. Thanks.</p>