
> module VectorSpace where
> import NumPrelude
> import qualified Prelude
>
> -- Is this right?
> infixl 7 *>, <*
>
> class (Num a, Additive b) => Module a b where
>     (*>) :: a -> b -> b

A module over a ring satisfies:

   a *> (b + c) === a *> b + a *> c
   (a * b) *> c === a *> (b *> c)
   (a + b) *> c === a *> c + b *> c

For instance, the following function can be used to define any
Additive as a module over Integer:

-- where is SmallIntegral defined ?

> integerMultiply :: (Additive b) => Integer -> b -> b
> integerMultiply a b = reduceRepeated (+) zero b a

There are no instance declarations by default, since they would
overlap with too many other instances and would be slower than
desired.

> class (Num a, Additive b) => RightModule a b where
>     (<*) :: b -> a -> b

> class (Fractional a, Additive b) => VectorSpace a b

> class (VectorSpace a b) => DivisibleSpace a b where
>     (</>) :: b -> b -> a

DivisibleSpace is used for free one-dimensional vector spaces.  It
satisfies

  (a </> b) *> b = a

Examples include dollars and kilometers.
