[Haskell] type inference & instance extensions

Doug McIlroy doug at cs.dartmouth.edu
Mon Jan 19 08:36:54 EST 2009

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)

Unfortunately, type inference isn't strong enough to cope with


Why shouldn't it be strengthened to do so?
Or is there a declarative trick (perhaps with dependent
classes) that will accomplish the goal?

Doug McIlroy

More information about the Haskell mailing list