packages feed

PrimitiveArray 0.4.0.0 → 0.4.0.1

raw patch · 2 files changed

+17/−18 lines, 2 filesdep ~primitivedep ~vectorPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: primitive, vector

API changes (from Hackage documentation)

- Data.PrimitiveArray.Zero: Arr0 :: !sh -> !(Array elm) -> Arr0 sh elm
+ Data.PrimitiveArray.Zero: Arr0 :: !sh -> !(Vector elm) -> Arr0 sh elm
- Data.PrimitiveArray.Zero: MArr0 :: !sh -> !(MutableArray s elm) -> MArr0 s sh elm
+ Data.PrimitiveArray.Zero: MArr0 :: !sh -> !(MVector s elm) -> MArr0 s sh elm

Files

Data/PrimitiveArray/Zero.hs view
@@ -10,23 +10,22 @@ import Control.Monad import Data.Array.Repa.Index import Data.Array.Repa.Shape-import Data.Primitive-import Data.Primitive.Array-import Data.Primitive.Types import Control.Exception (assert)+import Data.Vector as VU hiding (forM_, length, zipWithM_)+import Data.Vector.Mutable as VUM hiding (length)  import Data.ExtShape import Data.PrimitiveArray   --- | Monadic arrays of primitive type.+-- | Monadic arrays of boxed type. -data MArr0 s sh elm = MArr0 !sh !(MutableArray s elm)+data MArr0 s sh elm = MArr0 !sh !(MVector s elm) --- | Immutable arrays of primitive type.+-- | Immutable arrays of boxed type. -data Arr0 sh elm = Arr0 !sh !(Array elm)+data Arr0 sh elm = Arr0 !sh !(Vector elm)   @@ -41,19 +40,19 @@     ma <- newM inLb inUb     let exUb = inUb `addDim` unitDim     let (MArr0 _ mba) = ma-    zipWithM_ (\k x -> assert (length xs == size exUb) $ writeArray mba k x) [0.. toIndex exUb inUb] xs+    zipWithM_ (\k x -> assert (length xs == size exUb) $ unsafeWrite mba k x) [0.. toIndex exUb inUb] xs     return ma   newM inLb inUb = let exUb = inUb `addDim` unitDim in     unless (inLb == zeroDim) (error "MArr0 lb/=zeroDim") >>-    MArr0 exUb `liftM` newArray (size exUb) undefined+    MArr0 exUb `liftM` new (size exUb)   newWithM inLb inUb def = do     let exUb = inUb `addDim` unitDim     ma <- newM inLb inUb     let (MArr0 _ mba) = ma-    forM_ [0 .. toIndex exUb inUb] $ \k -> writeArray mba k def+    forM_ [0 .. toIndex exUb inUb] $ \k -> unsafeWrite mba k def     return ma-  readM (MArr0 exUb mba) idx = assert (inShape exUb idx) $ readArray mba (toIndex exUb idx)-  writeM (MArr0 exUb mba) idx elm = assert (inShape exUb idx) $ writeArray mba (toIndex exUb idx) elm+  readM (MArr0 exUb mba) idx = assert (inShape exUb idx) $ unsafeRead mba (toIndex exUb idx)+  writeM (MArr0 exUb mba) idx elm = assert (inShape exUb idx) $ unsafeWrite mba (toIndex exUb idx) elm   {-# INLINE boundsM #-}   {-# INLINE fromListM #-}   {-# INLINE newM #-}@@ -63,8 +62,8 @@  instance (Shape sh, ExtShape sh) => PrimArrayOps Arr0 sh elm where   bounds (Arr0 exUb _) = (zeroDim,exUb `subDim` unitDim)-  freeze (MArr0 exUb mba) = Arr0 exUb `liftM` unsafeFreezeArray mba-  index (Arr0 exUb ba) idx = assert (inShape exUb idx) $ indexArray ba (toIndex exUb idx)+  freeze (MArr0 exUb mba) = Arr0 exUb `liftM` unsafeFreeze mba+  index (Arr0 exUb ba) idx = assert (inShape exUb idx) $ unsafeIndex ba (toIndex exUb idx)   {-# INLINE bounds #-}   {-# INLINE freeze #-}   {-# INLINE index #-}
PrimitiveArray.cabal view
@@ -1,5 +1,5 @@ Name:           PrimitiveArray-Version:        0.4.0.0+Version:        0.4.0.1 License:        BSD3 License-file:   LICENSE Author:         Christian Hoener zu Siederdissen@@ -38,9 +38,9 @@ --    Data.PrimitiveArray.UpperTriangular.Unboxed --    Data.PrimitiveArray.FillTable   Build-depends:-    base >= 4 && <5,-    primitive == 0.5  ,-    vector    == 0.10+    base      >= 4 && <5  ,+    primitive >= 0.5.0.1  ,+    vector    >= 0.10.0.1   ghc-options:     -O2     -funbox-strict-fields