Koen Claessen wrote:
| instance (Num a) => Op_plus a MyInt where | i `plus` (MyInt b) = i + b
Remember that b is of type Int, but you also say that i is of any Num type. This clashes, since + requires both if its arguments to hve the same types.
You are right! I did't notice that error. Here is a version of the example free (if a remove the last instance compiles cleanly) of this mistake.
data MyInt = MyInt Integer deriving Show
class Op_plus a b where
plus :: a -> b -> Integer instance Op_plus MyInt MyInt where
(MyInt a) `plus` (MyInt b) = a + b instance (Integral a) => Op_plus a MyInt where
i `plus` (MyInt b) = (toInteger i) + bObs: perhaps MyInt should be now MyInteger. :-)
-- Razvan ME
_______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
