@@ -113,6 +113,10 @@ instance Eq Char where
113113instance Eq String where
114114 (==) = boolOp prim__eqString
115115
116+instance (Eq a, Eq b) => Eq (a, b) where
117+ (==) (a, c) (b, d) = (a == b) && (c == d)
118+
119+
116120data Ordering = LT | EQ | GT
117121
118122class Eq a => Ord a where
@@ -172,6 +176,13 @@ instance Ord String where
172176 GT
173177
174178
179+instance (Ord a, Ord b) => Ord (a, b) where
180+ compare (xl, xr) (yl, yr) =
181+ if xl /= yl
182+ then compare xl yl
183+ else compare xr yr
184+
185+
175186class (Eq a, Ord a) => Num a where
176187 (+) : a -> a -> a
177188 (-) : a -> a -> a