title: Data type parametrized by constant in Haskell
body: <p>I would like to define a data type in Haskell which is parametrized by an <code>Int</code> constant along the lines:</p>
  <p><code>data Q (n :: Int) = Q n (Int,Int) -- non-working code</code></p>
  <p>in order to allow me to define functions of the type:</p>
  <pre><code>addQ :: (Q n)-&gt;(Q n)-&gt;(Q n)
  addQ (Q k (i1,j1)) (Q k (i2,j2))) = Q k (i1+i2,j1+j2)
  </code></pre>
  <p>The idea is that in this way I am able to restrict addition to <code>Q</code>'s that have the same <code>n</code>. Intuitively, it feels that this should be possible, but so far all my (admittedly newbie) attempts have stranded on the rigors of GHC.</p>