Hi Slavomir,
On 11/28/06, Slavomir Kaslev <[EMAIL PROTECTED]> wrote:
instance Num Float3 where
.....
signum a | a == Float3 0 0 0 = 0
| otherwise = 1
signum has a natural generalization for vectors.
signum v = vector with the same direction as v but with |v| = 1
where |v| is the absolute length of v. The problematic function in Num
is abs. Ideally abs should be defined as:
abs v = |v|
but its type is Float3 -> Float while the Num class requires Float3 -> Float3.
Cheers,
Krasimir
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe