Haskell Array Index out of range Haskell Array Index out of range arrays arrays

Haskell Array Index out of range


I suspect the index out of range exception is not being caused in the expression that you think it is!

Data.Array.listArray (1,-10) [2,3,4,5]

does not throw any exception, it just gives you an empty array. Also note the column numbers in the last debug message:

Stopped at SVMCF.hs:125:60-86

60 to 86 is map (\(u,i,r) -> [u,i]) rts which doesn't obviously have any indexing going on in it: There's certainly none in map, nor in its first argument, and rts looks clean too as it comes straight from ua.base via Parsec.

Because Haskell is allowed to be fairly free with its evaluation order, it's possible that the exception is being thrown by a reduction in a completely different expression. Are you sure all the other things you're passing into SVM are set up correctly? In particular, given that you're using Int-indexed arrays, are you sure there's no integer overflow occurring in any array? Are any of your datasets, for example, 4101507735 or 8396475031 records long, because these overflow to -193459561 as Int).

Does the :history command in the GHCi debugger give you any more information?