yes...sorry this has been asked before, but usually about something so specific and complex that it in incomprehensible
with a naïve OO head...we go....
class Animal a where
class Mammal m where
class Insect i where
instance (Mammal m) => Animal m
instance (Insect i) => Animal i
and ghc goes
Duplicate instance declarations:
instance forall (k :: BOX) (m :: k). Mammal m => Animal m
instance forall (k :: BOX) (i :: k). Insect i => Animal i
and you look it up...and there is a solution using witness types, that I could probably get to work BUT....I don't understand what the problem?
allegedly the compiler matches the right hand side and bla bla...?
I don't understand....I think I'm saying...if I have a type of typeclass Dog...then its also of typeclass Animal...so if I call methods foo etc then this is how to do it (in terms of a Dog)
I'm missing something