Ignore-this: f58ceb5e1068be132b0a67a851b096f4 This has two advantages: 1. TemplateHaskell is painfully slow. There, I said it. 2. TemplateHaskell doesn't yet support some extensions that can be usefull for this library. Specifically the MagicHash extension. darcs-hash:20090813023321-a4fee-0da13d0da6454f6ba3bd111ed6b80268d9e1b45c
15 lines
402 B
Haskell
15 lines
402 B
Haskell
{-# LANGUAGE MagicHash #-}
|
|
module Data.Array.Static where
|
|
|
|
import Data.Static
|
|
import GHC.Exts
|
|
import Data.Ix
|
|
|
|
data StaticArray i e = StaticArray i i Addr#
|
|
|
|
bounds :: Ix i => StaticArray i e -> (i,i)
|
|
bounds (StaticArray s e _) = (s,e)
|
|
|
|
(!) :: (StaticElement e,Ix i) => StaticArray i e -> i -> e
|
|
(!) (StaticArray s e addr) i = let (I# ri) = index (s,e) i
|
|
in extract addr ri |