title: Haskell for defining a programming language
body: <p>I have googled about trying to find a simple example of Haskell being used to define a simple language but to no avail.</p>
  
  <p>I did find this post on stackoverflow giving a similar example, but when i implemented it, it didn't appear to work:</p>
  
  <p><a href="https://stackoverflow.com/questions/679815/haskell-how-to-best-to-represent-a-programming-languages-grammar">Haskell - How to best to represent a programming language&#39;s grammar?</a></p>
  
  <blockquote>
    <p>an example expression in this language would be:</p>
    
    <p>if true then x else (if false then y else true) Your Haskell data type
    would look something like this:</p>
  </blockquote>
  
  <pre><code>data Expr = Var String
            | Lit Bool
            | If Expr Expr Expr
  </code></pre>
  
  <p>however, when i entered if true then x else (if false then y else true) into the console as input, it complained about "x" not being interpretable. It also didn't like true and false.</p>
  
  <p>EDIT: I did derive "show" also, at the end</p>