title: Haskell: type classes: multiple inheritance example
body: <p>I came to know that we can achieve multiple inheritance using type classes. I had written small haskell code, but unable to figure out the problem.</p>
  
  <pre><code>{-# LANGUAGE GeneralizedNewtypeDeriving #-}
  {-# LANGUAGE DeriveAnyClass #-}
  {-# LANGUAGE StandaloneDeriving #-}
  
  class (Eq a, Show a) =&gt; C a where
      getHashCode :: a -&gt; Integer
      getHashCode obj = 123
  
  
  type Id = Int
  type Name = String
  
  data Employee = Employee Id Name deriving C
  </code></pre>
  
  <p>When i tried to load above code, I am getting following error. Any help on this.</p>
  
  <pre><code> No instance for (Eq Employee)
        arising from the 'deriving' clause of a data type declaration
     Possible fix:
        use a standalone 'deriving instance' declaration,
          so you can specify the instance context yourself
      When deriving the instance for (C Employee)
  Failed, modules loaded: none.
  </code></pre>
  
  <p>I searched google some time, but unable to found good example for multiple inheritance. it will be helpful if you provide some info, example on multiple inheritance in Haskell.</p>
  
  <p>Reference: <a href="https://www.haskell.org/tutorial/classes.html" rel="nofollow">https://www.haskell.org/tutorial/classes.html</a></p>