Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module is a drop-in replacement for Control.Concurrent.STM.TArray
in the stm
package. It has the same fundamental inefficiency of the
classic TArray
, but it's a little faster and more compact.
Specifically, this implementation uses two fewer words of memory
and one fewer indirection per element.
We also add an MArray
instance for working in IO
that the stm
version lacks.
Finally, the Eq
instance for the official TArray
is currently a little broken
thanks to a bug in the instance for Data.Array.Array
(See GHC Gitlab issue
#18700). We fix that bug here.
Documentation
Instances
MArray TArray e STM Source # | |
Defined in Data.Primitive.TArray.Classic getBounds :: Ix i => TArray i e -> STM (i, i) # getNumElements :: Ix i => TArray i e -> STM Int newArray :: Ix i => (i, i) -> e -> STM (TArray i e) # newArray_ :: Ix i => (i, i) -> STM (TArray i e) # unsafeNewArray_ :: Ix i => (i, i) -> STM (TArray i e) unsafeRead :: Ix i => TArray i e -> Int -> STM e unsafeWrite :: Ix i => TArray i e -> Int -> e -> STM () | |
MArray TArray e IO Source # | Writes are slow in |
Defined in Data.Primitive.TArray.Classic getBounds :: Ix i => TArray i e -> IO (i, i) # getNumElements :: Ix i => TArray i e -> IO Int newArray :: Ix i => (i, i) -> e -> IO (TArray i e) # newArray_ :: Ix i => (i, i) -> IO (TArray i e) # unsafeNewArray_ :: Ix i => (i, i) -> IO (TArray i e) unsafeRead :: Ix i => TArray i e -> Int -> IO e unsafeWrite :: Ix i => TArray i e -> Int -> e -> IO () | |
Eq i => Eq (TArray i a) Source # | |