Re[2]: [Haskell-cafe] Error in array index.

2009-06-25 Thread Bulat Ziganshin
Hello Claus, Thursday, June 25, 2009, 11:50:12 AM, you wrote: > PS. You could, of course, rebase your array indices to make > use of the negatives, so the address space isn't wasted, just > made difficult to use. no, he can't - internally indexes are always counted from 0, so array canno

Re: [Haskell-cafe] Error in array index.

2009-06-25 Thread Claus Reinke
It's too bad that indexes are `Int` instead of `Word` under the hood. Why is `Int` used in so many places where it is semantically wrong? Not just here but also in list indexing... Indices/offsets can only be positive and I can't see any good reason to waste half the address space -- yet we e

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread wren ng thornton
Jason Dusek wrote: Why is `Int` used in so many places where it is semantically wrong? Not just here but also in list indexing... Indices/offsets can only be positive and I can't see any good reason to waste half the address space -- yet we encounter this problem over and over again.

Re[4]: [Haskell-cafe] Error in array index.

2009-06-24 Thread Bulat Ziganshin
Hello Jason, Wednesday, June 24, 2009, 10:15:14 PM, you wrote: >> particular, in windows 32-bit program cannot alloc memory >> block larger than 2gb > But on everything but Windows... well, people never thought about such things until they really get into using 4gb RAM with 32-bit systems :)

Re: Re[2]: [Haskell-cafe] Error in array index.

2009-06-24 Thread Jason Dusek
So now I get to write a blog post called "Compact Bit Arrays in Haskell" or some such. -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re[2]: [Haskell-cafe] Error in array index.

2009-06-24 Thread Jason Dusek
2009/06/24 Bulat Ziganshin : > Wednesday, June 24, 2009, 9:51:59 PM, you wrote: > > It's too bad that indexes are `Int` instead of `Word` under > > actually, it doesn't matter too much except for Bools. 2gb > array is a way too much for most 32-bit systems, in > particular, in windows 32-bit progra

Re[2]: [Haskell-cafe] Error in array index.

2009-06-24 Thread Bulat Ziganshin
Hello Jason, Wednesday, June 24, 2009, 9:51:59 PM, you wrote: > It's too bad that indexes are `Int` instead of `Word` under actually, it doesn't matter too much except for Bools. 2gb array is a way too much for most 32-bit systems, in particular, in windows 32-bit program cannot alloc memory b

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread Jason Dusek
2009/06/24 Daniel Fischer : > Am Mittwoch 24 Juni 2009 18:50:49 schrieb Jason Dusek: > > 2009/06/24 Ketil Malde : > > > So in effect, you have a zero-length underlying array, but > > > the array implementation still keeps track of the real > > > indices and tries to print some contents.  (Correct?)

Re[2]: [Haskell-cafe] Error in array index.

2009-06-24 Thread Bulat Ziganshin
Hello Jason, Wednesday, June 24, 2009, 8:50:49 PM, you wrote: >> Aren't you asking for a 4G element array here, so with a 32bit >> wraparound the array will be some multiple of 4GB > It's a bit array. It'd be 512MiB. internally it's indexed by plain Int :) when library checks index boundary,

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread Daniel Fischer
Am Mittwoch 24 Juni 2009 18:50:49 schrieb Jason Dusek: > 2009/06/24 Ketil Malde : > > Bulat Ziganshin writes: > >>>     array ((0,0),(65535,65535)) [((0,0),*** Exception: Error in array > >>> index > >> > >> i think that it may be a bit too large for internal Int indicies: > > > > Aren't you askin

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread Jason Dusek
2009/06/24 Ketil Malde : > Bulat Ziganshin writes: > >>>     array ((0,0),(65535,65535)) [((0,0),*** Exception: Error in array index > >> i think that it may be a bit too large for internal Int indicies: > > Aren't you asking for a 4G element array here, so with a 32bit > wraparound the array will

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread Ketil Malde
Bulat Ziganshin writes: >> array ((0,0),(65535,65535)) [((0,0),*** Exception: Error in array index > i think that it may be a bit too large for internal Int indicies: Aren't you asking for a 4G element array here, so with a 32bit wraparound the array will be some multiple of 4GB, and be tru

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread Bulat Ziganshin
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 s

[Haskell-cafe] Error in array index.

2009-06-24 Thread Jason Dusek
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, Word1