[Haskell-cafe] matrix computations based on the GSL

Jacques Carette carette at mcmaster.ca
Thu Jun 30 12:32:40 EDT 2005


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''. 

Jacques


More information about the Haskell-Cafe mailing list