I'm trying to make a program that has massive updates on one large array, but evaluates only few times. I want computations to be lazy as possible, but I can't find out which Array representation is good for my case. To be specific, I want my array to:
- have fixed size
- access in constant time
- update n elements in O(n)
- lazy evaluated
How to approach these requirements? As a sub-question: are there libraries specifically geared for this use case?
EDIT:
Maybe my question wasn't specific enough, so I'll try to explain about my case more.
I'm trying to represent various size of image which can be either relatively small(about 1200x800), or much larger than that(at least 8000x8000). Also, there will be lots of layers for one image, which means that if I want to draw image on screen, there will be lots of updates on frame buffer image. I thought if I can exploit lazy-evaluated nature of haskell, I would be able to write on frame buffer only once, rather than overwriting same pixel at each updates.
I'm aware of several options for representing array in haskell, but all of those doesn't seem to fit in my case. For example:
- Data.Seq, Data.IntTrie : can't be accessed in constant time
- Data.Vector, Data.Array : update n elements takes more than O(n)
- Unboxed variants : not lazy-evaluated(I guess?)
What approach should I take in this situation?

Seqcertainly aims in the right direction, perhaps you could change your question to ask whether that specific type fulfills your requirements.computeUnboxedP. IIRC delayed arrays aren't strict.