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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to