[Haskell-cafe] Error in array index.
Bulat Ziganshin
bulat.ziganshin at gmail.com
Wed Jun 24 06:09:25 EDT 2009
Hello Jason,
Wednesday, June 24, 2009, 1:55:24 PM, you wrote:
> array ((0,0),(65535,65535)) [((0,0),*** Exception: Error in array index
> What do I need to do to debug this?
i think that it may be a bit too large for internal Int indicies:
safeIndex :: Ix i => (i, i) -> Int -> i -> Int
safeIndex (l,u) n i = let i' = unsafeIndex (l,u) i
in if (0 <= i') && (i' < n)
then i'
else error "Error in array index"
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list