
20 May
2008
20 May
'08
5:25 p.m.
GHC's (maybe Haskell98's?) Complex type is defined with a RealFloat constraint on type type itself, rather than on some of the instances and functions: data (RealFloat a) => Complex a = !a :+ !a I think the practice of constraint in type definitions is generally discouraged, and I'm wondering if there are reasons other than history for having the constraint here. Is removing it on the table for Haskell'? I just got bit by what I think is a typical problem. I added a VectorSpace instance for 'Complex a' and discovered that my 'a' must be in RealFloat, even though I use only zero, addition, subtraction, and scaling. I suspect this gripe has been raised before ... Thanks, - Conal