I'm learning Haskell and I've been given following assignment - I have a newtype consisting of two mixed data types, and I have to make it an instance of Eq without using deriving. Here's what I have:
data Number = One | Two | Three deriving Eq
data Character = A | B | C deriving Eq
newtype Combo = Combo ((Character, Character),(Number, Number))
instance Eq Combo where
Combo ((a1, a2),(x1,x2)) == Combo ((b1, b2),(y1, y2)) = (a1 == b1) && (a2 == b2) && (x1 == y1) && (x2 == y2)
However, Hugs goes all
ERROR "testing.hs":5 - Ambiguous class occurrence "Eq"
*** Could refer to: Hugs.Prelude.Eq Main.Eq Main.Eq Main.Eq Main.Eq Main.Eq
How do I fix this? I can't really import Eq hiding something either since I need it to check if a given member of Number or Character is equal.