title: why does the compiler give error on the following haskell code?
body: <p>I am trying to study the type classes in haskell. I write the following script and the raised an error. I am unable to understand why the compiler thinks of v as an concrete type while it is just a parameter for class Boxer.</p>
  
  <pre><code>data Box1 a b = Box1 Double a [b]
  
  class Boxer v where
    foo :: (v a b) -&gt; Double
  
  instance Boxer (Box1 a b) where
    foo (Box1 r s t) = r
  </code></pre>
  
  <p>it raises an error in line 7:8:</p>
  
  <pre><code>Couldn't match type `v' with `Box1'
    `v' is a rigid type variable bound by
        the type signature for foo :: v a b -&gt; Double at file1.hs:4:10
  Expected type: v a b
    Actual type: Box1 a b
  Relevant bindings include
    foo :: v a b -&gt; Double (bound at file1.hs:7:3)
  In the pattern: Box1 r s t
  In an equation for `foo': foo (Box1 r s t) = r
  Failed, modules loaded: none.
  </code></pre>