
I didn't get the point yet why the context for 'data' is not sufficient for the 'instance' method definition.
Not sure who's relpy you're replying to, but I thought my response was pretty clear (I would though)... The problem is that to define 'zero' the type of the 'zero' must unify with the vector type. If you define vector operations as (v a) then a is a polymorphic variable. However the definition of zero implies that a is an Integral .. these are not the same type: (forall a . a) is not (forall a . Integral a => a) and thats where the type error comes from. You have two choices, drop the definition of zero, or use multi-parameter type classes. You could get rid of zero and have: class VectorSpace v where set :: Num a => a -> v a add :: Num a => v a -> v a -> v a scale :: Num a => a -> v a -> v a Should do the trick! (zero becomes "set 0") Regards, Keean.