[Haskell-cafe] vector-space and standard API for vectors

Daniel Fischer daniel.is.fischer at web.de
Thu Nov 4 11:02:34 EDT 2010


On Thursday 04 November 2010 15:33:09, Jacques Carette wrote:
> On 02/11/2010 8:16 PM, Conal Elliott wrote:
> > > Vector (Complex a) is a vector with respect to both 'a' and 'Complex
> > > a'.
> >
> > Even worse, () is a vector w.r.t. *every* scalar type.
>
> Why is this bad?

It's bad for making a type class with a "Scalar" type family (or FunDeps).

instance VectorSpace () where
    type Scalar () = ???

> () is the canonical 0-dimensional vector space.
> 0-dimensional vector spaces are very useful because they allow quite a
> number of linear algebra algorithms to be stated ``inductively'' with no
> funny special cases.
>
> Jacques



More information about the Haskell-Cafe mailing list