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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -