On 2009 Jan 23, at 17:58, Olex P wrote:
class Vector v where
    (^+^)       :: v -> v -> v

class Matrix m where
    (^+^)     :: m -> m -> m

You can't reuse the same operator in different classes. Vector "owns" (^+^), so Matrix can't use it itself. You could say

> instance Matrix m => Vector m where
>   (^+^) = ...

allowing Matrix to "inherit" Vector's operator (or turn it around the other way, make it Matrix then make Vector a Matrix), but that's only linguistically possible, not necessarily mathematically sane.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to