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
Post a Comment