27 Jan
2009
27 Jan
'09
6:05 p.m.
On Tue, Jan 27, 2009 at 4:51 AM, <oleg@okmij.org> wrote:
Doug McIlroy wrote:
A fragment of an attempt to make pairs serve as complex numbers, using ghc/hugs extensions:
instance Num a => Num (a,a) where (x,y) * (u,v) = (x*u-y*v, x*v+y*u) The recent versions of GHC have a nifty equality constraint, so the code can be written simply
I'm confused on why instance Num a => Num (a, a) where is not equivalent to instance (Num a, Num b, a ~ b) => Num (a, b) where I don't know the details of the type inference algorithm. What am I missing to understand why they are not the same? Cheers, Corey O'Connor