[Haskell-cafe] matrix computations based on the GSL

Henning Thielemann lemming at henning-thielemann.de
Thu Jun 30 12:24:15 EDT 2005


On Thu, 30 Jun 2005, Jacques Carette wrote:

> Henning Thielemann wrote:
>
> >I'm uncertain about how who want to put the different kinds of
> >multiplication into one method, even with multi-parameter type classes.
> >You need instances
> >
> > (*) :: Matrix -> Matrix -> Matrix
> > (*) :: RowVector -> Matrix -> RowVector
> >
> >
> [many other instances removed.]
>
> Definitely not.  You could do:
> Data Orientation = Row | Column
> Data Vector a = Vector Orientation [a]

In the first mail you wrote
 "9. There are row vectors and column vectors, and these are different
types.  You get type errors if you mix them incorrectly."

I interpreted that you want to encode the information Row or Column into
the type. This sounds reasonable to me because multiplying e.g. a column
vector by a matrix is so obviously wrong that it should be detected
statically.



More information about the Haskell-Cafe mailing list