    {-# LANGUAGE MagicHash,BangPatterns #-}
    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 :: forall i e. Ix i => StaticArray i e -> (i, i)
    bounds (StaticArray i
    s i
    e Addr#
    _) = (i
    s,i
    e)

    (!) :: (StaticElement e,Ix i) => StaticArray i e -> i -> e
    ! :: forall e i. (StaticElement e, Ix i) => StaticArray i e -> i -> e
    (!) (StaticArray i
    s i
    e Addr#
    addr) i
    i = let !(I# Int#
    ri) = (i, i) -> i -> Int
    forall a. Ix a => (a, a) -> a -> Int
    index (i
    s,i
    e) i
    i
                                   in Addr# -> Int# -> e
    forall e. StaticElement e => Addr# -> Int# -> e
    extract Addr#
    addr Int#
    ri