How overload operator in Haskell?
Hal Daume
t-hald@microsoft.com
Wed, 9 Jul 2003 08:34:26 -0700
Quite right :). I agree whole-heartedly. There's nothing wrong with
overloading (+) and (-) in this case, but the rest really don't make
much sense. Probably best to leave them undefined and just not use
them. Then you could define your own dot product function and the like.
--
Hal Daume III | hdaume@isi.edu
"Arrest this man, he talks in maths." | www.isi.edu/~hdaume
> -----Original Message-----
> From: haskell-admin@haskell.org=20
> [mailto:haskell-admin@haskell.org] On Behalf Of Jerzy Karczmarczuk
> Sent: Wednesday, July 09, 2003 8:25 AM
> To: haskell@haskell.org
> Subject: Re: How overload operator in Haskell?
While this is a possible solution, I would shout loudly: "Arrest this
man, he
is disrespectful wrt math!". Actually, this shows once more that the Num
class
and its relatives is a horror...
Signum in this context has no sense. The multiplication might be the
cross
product, but its anti-commutativity shows plainly that this is not a
'standard'
multiplication. 'fromInteger' has even less sense than signum...
I am particularly horrified by "abs v =3D map abs v", and I am sure all =
of
you
see why.
I think that a more sane solution would be the definition of a
particular class
with operations porting names like <+>, or ^+^, or whatever similar to
standard
ones, but different.
Jerzy Karczmarczuk
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell