I've learned haskell months, but I still can't understand the type system very well.
I can only write:
-----------------------------------
type Vector = [Double]
vadd,vsub :: Vector->Vector->Vector
v1 `vadd` v2 = zipWith (+) v1 v2
v1 `vsub` v2 = zipWith (-) v1 v2
svmul :: Double->Vector->Vector
s `svmul` v = map (s*) v
------------------------------------
Tough it works, it is not convenient to use. How to create a Vector type and overload
mathematical operators?
Thanks for your help.

        Liu Junfeng
[EMAIL PROTECTED]
          2003-07-04


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to