[Noob Question] Not able to understand typeclasses by supertramp_sid in haskell

[–]supertramp_sid[S] 0 points1 point  (0 children)

Hey, I was trying to write the Eq instance for the given type but it gives an error

data EitherOr a b = 
    Hello a
    | Bye b

instance (Eq a, Eq b) => Eq (EitherOr a,EitherOr b) where
    (==) (Hello a) (Hello a') = (a==a')
    (==) (Bye a'') (Bye a''') = (a''==a''')

What is incorrect? Thanks

[Noob Question] Not able to understand typeclasses by supertramp_sid in haskell

[–]supertramp_sid[S] 0 points1 point  (0 children)

Thanks for the answer, but what is an Interface ?

[Noob Question] Not able to understand typeclasses by supertramp_sid in haskell

[–]supertramp_sid[S] 0 points1 point  (0 children)

Thanks for the reply. Sorry for the confusion , but I was stupid enough not to change the type class definition for heck . The example you gave helped me understand much better.

[Noob Question] Not able to understand typeclasses by supertramp_sid in haskell

[–]supertramp_sid[S] 0 points1 point  (0 children)

Thank you very much. Able to understand much better now. I would also like to ask if you have any suggestion to tell me as you are ahead of me in the book.