[Haskell-beginners] I am having trouble with the type declaration for creating an identity matrix.

KC kc1956 at gmail.com
Tue Apr 24 23:20:16 CEST 2012


initIdentityMat :: Int -> ST s (STUArray s (Int,Int) ((Int, Int), Double))
initIdentityMat m = newListArray ((1,m),(1,m)) ([((i,j), if i == j then 1.0
else 0.0) | i <- [1..m], j <- [1..m]] :: [((Int,Int), Double)])

Doesn't seem to compile, nor do minor variations of the type declaration.

-- 
--
Regards,
KC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120424/fc9451fb/attachment.htm>


More information about the Beginners mailing list