Matrix operations in 100% pure Haskell