>Could not deduce (Num a) from the context (VectorSpace VList)

The problem is in the definition: 

zero                      = VList (repeat 0)

Is "0" an Int or an Integer? 

To define zero, instances need to be parameterised by 
vector type:

EG:

class VectorSpace v a where
   zero  :: v a
   add   :: v a -> v a -> v a
   scale :: a -> v a -> v a

instance VectorSpace VList Int where
   zero                      = VList (repeat 0)
...

instance VectorSpace VList Float where
   zero                      = VList (repeat 0.0)

etc...


>Could not deduce (Num a) from the context (VectorSpace VList)

The problem is in the definition: 

zero                      = VList (repeat 0)

Is "0" an Int or an Integer? 

To define zero, instances need to be parameterised by 
vector type:

EG:

class VectorSpace v a where
   zero  :: v a
   add   :: v a -> v a -> v a
   scale :: a -> v a -> v a

instance VectorSpace VList Int where
   zero                      = VList (repeat 0)
...

instance VectorSpace VList Float where
   zero                      = VList (repeat 0.0)

etc...

        Regards,
        Keean.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to