
On Tue, 28 Nov 2006, Brian Hulley wrote:
While it may be tempting to want to use symbolic operators like + and -, these quickly become very confusing when more distinctions need to be made (eg between cross product, dot product, and scaling, or between transforming a position versus transforming a direction) so I'd argue that for readability descriptive names are better than symbols:
class Num a => Vector v a where plus :: v a -> v a -> v a minus :: v a -> v a -> v a cross :: v a -> v a -> v a dot :: v a -> v a -> a scale :: a -> v a -> v a magSquared :: v a -> a
I'm currently even thinking about an alternative of the multi-parameter class Vector that is Haskell 98. The problem with the multi-parameter type class is, that you cannot define instances where 'a' is a complex number type, say Num a => Vector [Complex a] (Complex a)