title: How do you allow GADTs in Haskell?
body: <p>Today I started to learn about GADTs from: <a href="https://downloads.haskell.org/~ghc/6.6.1/docs/html/users_guide/gadt.html">haskell.org</a> and <a href="https://wiki.haskell.org/GADTs_for_dummies">https://wiki.haskell.org</a></p>
  
  <p>Unfortunately, I don't know how to use them. If I run the code from the example I get the following error:</p>
  
  <pre><code>[1 of 1] Compiling Main             ( test.hs, interpreted )
  
  AFP_229.hs:31:1:
  Illegal generalised algebraic data declaration for `Term'
    (Use GADTs to allow GADTs)
  In the data declaration for `Term'
  Failed, modules loaded: none.
  Prelude&gt;
  </code></pre>
  
  <p>This is the code I am using:</p>
  
  <pre><code>data Term a where
    Lit    :: Int -&gt; Term Int
    Succ   :: Term Int -&gt; Term Int
    IsZero :: Term Int -&gt; Term Bool   
    If     :: Term Bool -&gt; Term a -&gt; Term a -&gt; Term a
    Pair   :: Term a -&gt; Term b -&gt; Term (a,b)
  </code></pre>
  
  <p>I have tried other sample code, but this gives me the same error. How do you allow GADTs?</p>