PrimitiveArray 0.0.3.1 → 0.0.4.0
raw patch · 3 files changed
+6/−18 lines, 3 filesdep ~primitivePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: primitive
API changes (from Hackage documentation)
Files
- Data/PrimitiveArray.hs +1/−0
- Data/PrimitiveArray/Ix.hs +2/−15
- PrimitiveArray.cabal +3/−3
Data/PrimitiveArray.hs view
@@ -54,6 +54,7 @@ (!) :: (PrimArrayOps a b) => PrimArray a b -> a -> b (!) pa idx = assert (checkBounds pa idx) $ unsafeIndex pa idx+{-# INLINE (!) #-} -- | Create a new array from an old one, mapping a function over all values.
Data/PrimitiveArray/Ix.hs view
@@ -4,11 +4,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} -- | PrimitiveArray with 'Ix' keys.------ NOTE GHC 6.12.3 (and earlier, I guess) does not produce optimal code.--- Current head (6.13) produces very nice code. For example, 'unsafeIndex' for--- 2-dim. tables with lower bound (0,0) produces one multiplication, one--- addition, one lookup, all using machine Int's. module Data.PrimitiveArray.Ix where @@ -24,7 +19,7 @@ instance (Bounded a, A.Ix a, Prim b) => PrimArrayOps a b where- data PrimArray a b = PaIxP {-# UNPACK #-} !a {-# UNPACK #-} !a {-# UNPACK #-} !ByteArray+ data PrimArray a b = PaIxP !a !a {-# UNPACK #-} !ByteArray unsafeIndex (PaIxP lb ub arr) i = indexByteArray arr (A.unsafeIndex (lb,ub) i) assocs (pa@(PaIxP lb ub _)) = [(i, unsafeIndex pa i) | i<-A.range(lb,ub) ] fromAssocs l u z xs = runST $ do@@ -45,7 +40,7 @@ {-# INLINE toList #-} instance (Bounded a, A.Ix a, Prim b) => PrimArrayOpsM a b (ST s) where- data PrimArrayM a b (ST s) = PaIxPM {-# UNPACK #-} !a {-# UNPACK #-} !a {-# UNPACK #-} !(MutableByteArray s)+ data PrimArrayM a b (ST s) = PaIxPM !a !a {-# UNPACK #-} !(MutableByteArray s) readM (PaIxPM lb ub marr) i = readByteArray marr (A.unsafeIndex (lb,ub) i) writeM (PaIxPM lb ub marr) i val = writeByteArray marr (A.unsafeIndex (lb,ub) i) val boundsM (PaIxPM lb ub _) = return (lb,ub)@@ -71,11 +66,3 @@ {-# INLINE fromListM #-} {-# INLINE toListM #-} ---{--test :: PrimArray (Int,Int) Int-test = fromList (1,1) (5,5) [ (i*6+j) | i<-[1..5], j<-[1..5] ]--testS = " " ++ show test ++ " " -- show (test,test)--}
PrimitiveArray.cabal view
@@ -1,5 +1,5 @@ Name: PrimitiveArray-Version: 0.0.3.1+Version: 0.0.4.0 License: BSD3 License-file: LICENSE Author: Christian Hoener zu Siederdissen@@ -16,7 +16,7 @@ Description: Provides unboxed multidimensional tables with a small interface. Comes with an instance for Ix keys. Read and Show- instances are provides for serialization.+ instances are provided for serialization. extra-source-files: Benchmarks/Index.hs@@ -28,7 +28,7 @@ Data.PrimitiveArray.Internal Build-depends: base >= 4 && <5,- primitive >= 0.3 && < 0.4+ primitive >= 0.4.0.1 && < 0.5 ghc-options: -O2