[Haskell-beginners] Matrix and types

Frederic Cogny frederic.cogny at gmail.com
Thu Mar 14 13:12:46 UTC 2019


The (experimental) Static module of hmatrix seems (I've used the packaged
but not that module) to do exactly that:
http://hackage.haskell.org/package/hmatrix-0.19.0.0/docs/Numeric-LinearAlgebra-Static.html



On Thu, Mar 14, 2019, 12:37 PM Francesco Ariis <fa-ml at ariis.it> wrote:

> Hello Mike,
>
> On Thu, Mar 14, 2019 at 11:10:06AM +0000, mike h wrote:
> > 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.
>
> Type-level literals [1] or any kind of similar trickery should help you
> with having matrices checked at compile-time.
>
> [1]
> https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/type-level-literals.html
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-- 
Frederic Cogny
+33 7 83 12 61 69
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190314/26a09d2d/attachment.html>


More information about the Beginners mailing list