#2200: big static random access arrays
--------------------------------+-------------------------------------------
    Reporter:  jsnx             |       Owner:          
        Type:  feature request  |      Status:  new     
    Priority:  normal           |   Component:  Compiler
     Version:  6.8.2            |    Severity:  normal  
    Keywords:  static array     |    Testcase:          
Architecture:  Multiple         |          Os:  Multiple
--------------------------------+-------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2200>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to