[Haskell-cafe] Error in array index.

Jason Dusek jason.dusek at gmail.com
Wed Jun 24 05:55:24 EDT 2009

  I'm using tuples to index into a `UArray` created like this:

    fromList :: [(Word16, Word16)] -> UArray (Word16, Word16) Bool
    fromList list            =  runSTUArray $ do
      arr                   <-  empty
      return arr

    empty                   ::  ST s (STUArray s (Word16, Word16) Bool)
    empty                    =  newArray ((0,0), (0xFFFF,0xFFFF)) False

  You'll notice this example doesn't do much; I'm not able to
  get much mileage so far. For example:

    > Array16Bit.fromList [(1,2), (2,3)]
    array ((0,0),(65535,65535)) [((0,0),*** Exception: Error in array index

  What do I need to do to debug this?

Jason Dusek

More information about the Haskell-Cafe mailing list