title: Syntax rules for Haskell infix datatype constructors
body: <p>I'm trying to make a Haskell datatype a bit like a python dictionary, a ruby hash or a javascript object, in which a string is linked to a value, like so:</p>
  
  <pre><code>data Entry t = Entry String t
  type Dictionary t = [Entry t]
  </code></pre>
  
  <p>The above code works fine. However, I would like a slightly nicer constructor, so I tried defining it like this:</p>
  
  <pre><code>data Entry t = String ~&gt; t
  </code></pre>
  
  <p>This failed. I tried this:</p>
  
  <pre><code>data Entry t = [Char] ~&gt; t
  </code></pre>
  
  <p>Again, it failed. I know that <code>~</code> has special meaning in Haskell, and GHCi still permits the operator <code>~&gt;</code>, but I still tried one other way:</p>
  
  <pre><code>data Entry t = [Char] &amp; t
  </code></pre>
  
  <p>And yet another failure due to parse error. I find this confusing because, for some inexplicable reason, this works:</p>
  
  <pre><code>data Entry t = String :&gt; t
  </code></pre>
  
  <p>Does this mean that there are certain rules for what characters may occur in infix type constructors, or is it a cast of misinterpretation. I'm not a newbie in Haskell, and I'm aware that it would be more idiomatic to use the first constructor, but this one's stumping me, and it seems to be an important part of Haskell that I'm missing.</p>