[Haskell-beginners] Matrix and types

mike h mike_k_houghton at yahoo.co.uk
Thu Mar 14 11:10:06 UTC 2019


As an exercise I want to write a Matrix library.

Multiplication of two matrices is only defined when the the number of columns in the first matrix 
equals the number of rows in the second matrix. i.e. c1 == r2

So when writing the multiplication function I can check that  c1 == r2 and do something.
However what I really want to do, if possible, is to have the compiler catch the error. 

I’d appreciate any advice on how to approach this. I don’t want a full description of exactly what to do as that way I won’t have struggled  or argued with the compiler - which for me is the best way to learn Haskell :)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190314/05213318/attachment.html>

More information about the Beginners mailing list