massiv 0.4.1.0 → 0.4.2.0
raw patch · 7 files changed
+28/−16 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- massiv.cabal +5/−1
- src/Data/Massiv/Array/Delayed/Stream.hs +5/−1
- src/Data/Massiv/Array/Manifest/Storable.hs +2/−1
- src/Data/Massiv/Array/Manifest/Vector/Stream.hs +2/−3
- src/Data/Massiv/Array/Mutable.hs +2/−5
- src/Data/Massiv/Core/Exception.hs +8/−5
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.4.2++* Fix loading empty `DS` stream arrays of unknown size. Fix for [#83](https://github.com/lehins/massiv/issues/83).+ # 0.4.1 * Introduction of `Stream` and `DS` representation:
massiv.cabal view
@@ -1,5 +1,5 @@ name: massiv-version: 0.4.1.0+version: 0.4.2.0 synopsis: Massiv (Массив) is an Array Library. description: Multi-dimensional Arrays with fusion, stencils and parallel computation. homepage: https://github.com/lehins/massiv@@ -13,6 +13,10 @@ extra-source-files: README.md , CHANGELOG.md cabal-version: >=1.10+tested-with: GHC == 8.4.3+ , GHC == 8.4.4+ , GHC == 8.6.3+ , GHC == 8.6.5 flag unsafe-checks description: Enable all the bounds checks for unsafe functions at the cost of
src/Data/Massiv/Array/Delayed/Stream.hs view
@@ -35,6 +35,7 @@ import Data.Massiv.Core.Common import GHC.Exts import Prelude hiding (take, drop)+import Data.Vector.Fusion.Bundle.Size (upperBound) -- | Delayed array that will be loaded in an interleaved fashion during parallel -- computation.@@ -150,8 +151,11 @@ -- | /O(n)/ - `size` implementation. instance Load DS Ix1 e where- size = SafeSz . S.length . coerce+ size = coerce . S.length . coerce {-# INLINE size #-}++ maxSize = coerce . upperBound . stepsSize . dsArray+ {-# INLINE maxSize #-} getComp _ = Seq {-# INLINE getComp #-}
src/Data/Massiv/Array/Manifest/Storable.hs view
@@ -195,7 +195,8 @@ _ -> unsafeDefaultLinearShrink marr sz {-# INLINE unsafeLinearShrink #-} - unsafeLinearGrow (MSArray _ mv) sz = MSArray sz <$> MVS.unsafeGrow mv (totalElem sz)+ unsafeLinearGrow (MSArray oldSz mv) sz =+ MSArray sz <$> MVS.unsafeGrow mv (totalElem sz - totalElem oldSz) {-# INLINE unsafeLinearGrow #-}
src/Data/Massiv/Array/Manifest/Vector/Stream.hs view
@@ -203,8 +203,7 @@ unstreamUnknown :: Mutable r Ix1 a => S.Stream Id a -> Array r Ix1 a unstreamUnknown str = runST $ do- let kInit = 1- marr <- unsafeNew (SafeSz kInit)+ marr <- unsafeNew zeroSz unstreamUnknownM marr str >>= unsafeFreeze Seq {-# INLINE unstreamUnknown #-} @@ -225,7 +224,7 @@ S.Skip t' -> stepLoad t' i kMax marr S.Done -> unsafeLinearShrink marr (SafeSz i) | otherwise = do- let kMax' = kMax * 2+ let kMax' = max 1 (kMax * 2) marr' <- unsafeLinearGrow marr (SafeSz kMax') stepLoad t i kMax' marr' {-# INLINE stepLoad #-}
src/Data/Massiv/Array/Mutable.hs view
@@ -91,6 +91,7 @@ -- TODO: add fromListM, et al. +import Data.Maybe (fromMaybe) import Control.Monad (void, when, unless, (>=>)) import Control.Monad.ST import Control.Scheduler@@ -245,7 +246,7 @@ newMaybeInitialized :: (Load r' ix e, Mutable r ix e, PrimMonad m) => Array r' ix e -> m (MArray (PrimState m) r ix e)-newMaybeInitialized !arr = initializeNew (defaultElement arr) (size arr)+newMaybeInitialized !arr = initializeNew (defaultElement arr) (fromMaybe zeroSz (maxSize arr)) {-# INLINE newMaybeInitialized #-} @@ -259,8 +260,6 @@ loadArrayS arr = do marr <- newMaybeInitialized arr unsafeLoadIntoS marr arr- -- loadArrayM trivialScheduler_ arr (unsafeLinearWrite marr)- -- pure marr {-# INLINE loadArrayS #-} @@ -275,8 +274,6 @@ liftIO $ do marr <- newMaybeInitialized arr unsafeLoadInto marr arr- -- withScheduler_ (getComp arr) $ \scheduler -> loadArrayM scheduler arr (unsafeLinearWrite marr)- -- pure marr {-# INLINE loadArray #-}
src/Data/Massiv/Core/Exception.hs view
@@ -12,9 +12,17 @@ import Control.Monad import Control.Monad.Catch import Data.Massiv.Core.Index.Internal++#if !MIN_VERSION_exceptions(0, 10, 3) import Control.Monad.ST (ST) import Control.Monad.ST.Unsafe (unsafeIOToST) +-- | Orphan instance in "massiv"+instance MonadThrow (ST s) where+ throwM = unsafeIOToST . throwIO+#endif++ newtype ImpossibleException = ImpossibleException SomeException deriving (Show)@@ -47,8 +55,3 @@ unless (totalElem sz == totalElem sz') $ throwM $ SizeElementsMismatchException sz sz' {-# INLINE guardNumberOfElements #-} -#if !MIN_VERSION_exceptions(0, 10, 3)--- | Orphan instance in "massiv"-instance MonadThrow (ST s) where- throwM = unsafeIOToST . throwIO-#endif