haskell - unsafeRead causing stack overflow -


here's code bounds checks @ ideone.

it runs no out of bounds error.

in this code, on line 34 have changed on readarray unsaferead, , still compiles, crashes stack overflow.

is ghc bug or have done wrong?

unsaferead uses 0-based indices, have either adjust index reading,

elem <- unsaferead arr (i-1) 

or, better, allocate array least index of 0

arr <- newarray (0,upperbound) maxbound 

as is, unsaferead reads wrong place in array.

unrelated: suspect ideone uses 32-bit ghc, better don't run code upperbound > 100000 there.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -