haskell - cannot construct the infinite type: e ~ [e] -


why code:

a=array ((0,0),(5,5)) [((i,j),x) | <- [0..5], j <- [0..5], x <- a!(i,j)] 

cause error cannot construct infinite type: e ~ [e], if rewrite this:

a=array ((0,0),(5,5)) [((i,j),a!(i,j)) | <- [0..5], j <- [0..5]] 

it works fine?

in list comprehension, right side of <- list take elements from. can use let expressions:

[ ... | ..., let x = ! (i,j) ] 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -