Could not deduce (Num [Char]) arising from the literal
<p>guys, i just started learning haskell (and to code) and i have ran into a problem that i can't figure out. So there is this exercise in which i have to present the number of solutions for a 2nd degree equation. </p>

<pre><code>valid a b c = if [a,b,c] == [0,0,0] then False
     else (if [a,b] == [0,0] then False
     else (if a == 0 then False 
     else True)) --function to make sure it is a 2nd degree eq

nRaizes a b c = if valid a b c == False then "not a valid eq" 
     else (if (b^2 - 4 * a * c) &gt; 0 then 2
     else (if ((b^2 - 4 * a * c) == 0) then 1 
     else 0)) 
</code></pre>

<p>Everything looked fine to me, but when i try to load the script in GHCI i get the error message:</p>

<pre><code>Could not deduce (Num [Char]) arising from the literal ‘2’
    from the context (Num a, Ord a)
      bound by the inferred type of
               nRaizes :: (Num a, Ord a) =&gt; a -&gt; a -&gt; a -&gt; [Char]
      at ficha1.hs:(18,1)-(21,13)
    In the expression: 2
    In the expression:
      (if (b * b - 4 * a * c) &gt; 0 then
       2
       else
           (if ((b * b - 4 * a * c) == 0) then 1 else 0))
    In the expression:
      if valid a b c == False then
          "not a valid eq"
      else
          (if (b * b - 4 * a * c) &gt; 0 then
           2
           else
               (if ((b * b - 4 * a * c) == 0) then 1 else 0))
Failed, modules loaded: none.
</code></pre>

<p>Can someone explain to me what is wrong with this code? And how can i fix it? Thanks</p>