title: Haskell: typeclass and instance (Not in scope: data constructor..)
body: <p>I want to make a typeclass Size with a method that given a value computes the number of
  constructors in this value.</p>
  
  <pre><code>class Size a where
    size :: a -&gt; Int
  
  instance Size Int where
    size a = 1
  
  instance Size Bool where
    size b = 1
  
  instance Size (c,d) where
    size (c,d) = 1 + Size c + Size d
  
  example4 :: (Bool,(Int,Bool))
  example4 = (True,(3,False))
  </code></pre>
  
  
  
  <pre><code>main :: IO ()    
  main = do
    print (size example4)
  </code></pre>
  
  <p>It should give me the value 5 but 
  I get the error Message <code>Not in scope: data constructor `Size'</code>. </p>
  
  <p>I want to use <code>Size Int</code> or <code>Size Bool</code> in the <code>Size(c,d)</code> instance, but have no idea how.</p>
  
  <p>My Problem is that I don't know how I can fix it, because I'm fairly new to Haskell.</p>