
23 Feb
2004
23 Feb
'04
1:53 p.m.
Was just thinking about GHC's implementation of arrays, and their poor performance. I know little about GHC's internal workings, but I was thinking about how array performance could be improved. What if when writing an array you instead construct a function: f :: (Ix x,Ix y) => Array a -> Ix x -> a -> Ix y -> a f a x b y | x==y = b | otherwise = a!y Then the update in place operator // becomes a curried application of 'f' above. You could then define a a series of 'overlays' for a base array. The clever bit would be to get the garbage collector to merge the two as soon as any reference to the original array is discarded. Does GHC already do anything like this? Regards, Keean Schupke.