Doug McIlroy <d...@cs.dartmouth.edu> wrote: > instance Num a => Num (a,a) where > (x,y) * (u,v) = (x*u-y*v, x*v+y*u) > > Unfortunately, type inference isn't strong enough to cope with > > (1,1)*(1,1)
I'm guessing it is because (fromInteger 1, fromInteger 1) :: (Num a, Num b) => (a,b) So you want to force the two components to be the same type: let x = 1 in (x,x)*(x,x) Or for differing component values: let x = 1 in (x,2`asTypeOf`x)*(3`asTypeOf`x,4`asTypeOf`x) Regards, Malcolm _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell