title: Haskell : understanding "No instance for" error messages in ghci
body: <p><strong>Question 1</strong></p>
  
  <p>Hi, if in WinGHCi I intentionally do the following wrong piece of code : </p>
  
  <pre><code>3 4
  </code></pre>
  
  <p>Then the error message I get is </p>
  
  <pre><code>&lt;interactive&gt;:1:1:
      No instance for (Num (a0 -&gt; t0))
        arising from the literal `3'
      Possible fix: add an instance declaration for (Num (a0 -&gt; t0))
      In the expression: 3
      In the expression: 3 4
      In an equation for `it': it = 3 4
  </code></pre>
  
  <p>What exactly does <code>No instance for (Num (a0 -&gt; t0))</code> mean?</p>
  
  <p><strong>Question 2</strong></p>
  
  <p>Why does the following piece of code : </p>
  
  <pre><code>(+) 2 3 4
  &lt;interactive&gt;:1:7:
      No instance for (Num (a0 -&gt; t0))
        arising from the literal `3'
      Possible fix: add an instance declaration for (Num (a0 -&gt; t0))
      In the second argument of `(+)', namely `3'
      In the expression: (+) 2 3 4
      In an equation for `it': it = (+) 2 3 4
  </code></pre>
  
  <p>yield a slightly different error from the second piece of code : </p>
  
  <pre><code>2+3 4
  &lt;interactive&gt;:1:3:
      No instance for (Num (a1 -&gt; a0))
        arising from the literal `3'
      Possible fix: add an instance declaration for (Num (a1 -&gt; a0))
      In the expression: 3
      In the second argument of `(+)', namely `3 4'
      In the expression: 2 + 3 4
  </code></pre>
  
  <p>Namely in the first piece of code we have <code>No instance for (Num (a0 -&gt; t0))</code> where as in the second piece of code we have <code>No instance for (Num (a1 -&gt; a0))</code>.</p>
  
  <hr>
  
  <p>[Response to ehird]</p>
  
  <p>(Questions moved from answer comments) : </p>
  
  <p>1) I appreciate the latter two expressions are different, but are you saying that I should not try to understand why the interpreter chooses <code>(Num (a0 -&gt; t0))</code> for the former and <code>(Num(a1 -&gt; a0))</code> for the latter, besides the fact that they are different?</p>
  
  <p>2)Hi, and with the former when you say "But there's no Num instance for functions" what do you mean? Sorry I am not clear on what the concept of an instance is. Furthermore, just out of curiosity, could you use your instance <code>Num (a -&gt; b)</code> method to somehow tell the interpreter to interpret <code>3 4</code> as <code>4 modulo 3</code>?</p>