title: Why does Haskell ignore the hard coded int in this example?
body: <p>Why does this only evaluate to x?:</p>
  <pre><code>(digitToInt (head (evalE x 0))) + 100
  </code></pre>
  <p>evalE x 0 evaluates to a string representation of x. The head part converts x to a Char, while the digitToInt turns it into an integer.</p>
  <p>I would expect it to evaluate to (x + 100), but it's always just x. Why is that?</p>
  <p>Here is the context of the evaluation:</p>
  <pre><code>import Data.Char(digitToInt)
  
  data Ast
      = Num Int
      | Plus Ast Ast
      deriving (Eq, Show)
  
  evalE (Num i) acc = show i
  
  evalE (Plus x y) acc = if (isDigit (head (evalE x 0))) &amp;&amp; (isDigit (head (evalE y 0))) then show ((digitToInt (head (evalE x 0))) + 100) else evalE x 0 
  </code></pre>
  <p>If I do &quot;evalE (Num 1) 0&quot;, I get &quot;1&quot; as the output.</p>