3 ms·
> Can the typechecker ensure that your matrices have compatible dimensions to be multiplied together? No? Yes. In fact this is one of the earliest examples [0]
by pash 12y ago
> Can the typechecker ensure that your matrices have compatible dimensions to be multiplied together? No?
Yes. In fact this is one of the earliest examples [0] of what you can do with the ever more numerous extensions to Haskell's type system.
There are BLAS bindings [1] and several native linear-algebra libraries in Hackage [2] that enlist the type-checker to enforce shape constraints at compile time.
0. See McBride (2001), "Faking It": http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.2636 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.2...
1. http://hackage.haskell.org/package/blas http://hackage.haskell.org/package/blas
2. Repa, for instance: http://hackage.haskell.org/package/repa http://hackage.haskell.org/package/repa, http://hackage.haskell.org/package/repa-algorithms http://hackage.haskell.org/package/repa-algorithms