big static random access arrays
These would be unlike StorableArray
s because they would be available at compile time, and would be pure values. They would amount to arrays of bytes, of course, but it'd be nice if they could be (Storable a) => StaticArray a
and we could walk down them or randomly access them to get the a
values out of them. They should be capable of storing hundreds of thousands of Int
s.
What are some functions that work on these arrays? We need just one:
indexInto :: (Storable a) => StaticArray a -> Word -> a
Then we can make a Monad
to walk up and down the array. It will be some State
hybrid. No IO
. A bright person could implement static Trie
s, RoseTree
s and other things using this Monad
-- storing the offsets mixed in with the data in an unholy mess and skipping forward or backward, leveraging "the world’s most beautiful imperative language."
It's been suggested (SamB) that this should be implemented in Template Haskell.
Important features of this array relative to other arrays and lists in Haskell:
Specificity of Index | A machine `Word` since that contains the finest grained pointer. When indexing into a `Storable a`, the index is multiplied by `sizeOf (undefined :: a)`. |
---|---|
Static Nature | Exists to facilitate large static constants. The array does not support any append or delete operations, there is no way to change any of its values and it can not be copied. |
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | SamB |
Operating system | Multiple |
Architecture | Multiple |