[Haskell-cafe] RealFloat constraint on Complex type
conal at conal.net
Tue May 20 17:25:51 EDT 2008
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
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe