On Thu, 30 Jun 2005, Jacques Carette wrote: > Henning Thielemann wrote: > > >>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. > > > Sorry, I should have been more precise, I used too straightforward an > encoding from Maple (which is dynamically typed) into Haskell. I should > have used the usual type-trickery to encode the Orientation as 2 > different types, to have ``types reflect values''.
You mean phantom types? data Vector orient a = Vector [a] I'm excited to add lots of new orientations then! :-] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe