packages feed

array 0.5.6.0 → 0.5.7.0

raw patch · 9 files changed

+34/−17 lines, 9 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Data.Array: data Array i e
+ Data.Array: data () => Array i e
- Data.Array.IArray: data Array i e
+ Data.Array.IArray: data () => Array i e
- Data.Array.IO: data IOArray i e
+ Data.Array.IO: data () => IOArray i e
- Data.Array.IO.Internals: newtype IOArray i e
+ Data.Array.IO.Internals: newtype () => IOArray i e
- Data.Array.IO.Safe: data IOArray i e
+ Data.Array.IO.Safe: data () => IOArray i e
- Data.Array.ST: data STArray s i e
+ Data.Array.ST: data () => STArray s i e
- Data.Array.ST.Safe: data STArray s i e
+ Data.Array.ST.Safe: data () => STArray s i e

Files

Data/Array/Base.hs view
@@ -834,10 +834,9 @@ in which the mutable array will be manipulated. -} class (Monad m) => MArray a e m where--    -- | Returns the bounds of the array (lowest,highest)+    -- | Returns the bounds of the array (lowest,highest).     getBounds      :: Ix i => a i e -> m (i,i)-    -- | Returns the number of elements in the array+    -- | Returns the number of elements in the array.     getNumElements :: Ix i => a i e -> m Int      -- | Builds a new array, with every element initialised to the supplied@@ -892,6 +891,8 @@     -- default initialisation with undefined values if we *do* know the     -- initial value and it is constant for all elements. +    {-# MINIMAL getBounds, getNumElements, (newArray | unsafeNewArray_), unsafeRead, unsafeWrite #-}+ instance MArray IOArray e IO where     {-# INLINE getBounds #-}     getBounds (IOArray marr) = stToIO $ getBounds marr@@ -913,17 +914,25 @@         f x k i             | i == n    = return ()             | otherwise = unsafeWrite marr i x >> k (i+1)-    foldr f (const (return ())) es 0+    foldr f (\ !_i -> return ()) es 0+    -- The bang above is important for GHC for unbox the Int.     return marr  {-# INLINE newGenArray #-} -- | Constructs a mutable array using a generator function. -- It invokes the generator function in ascending order of the indices. newGenArray :: (MArray a e m, Ix i) => (i,i) -> (i -> m e) -> m (a i e)-newGenArray (l,u) f = do-    marr <- newArray_ (l,u)-    let n = safeRangeSize (l,u)-    sequence_ [ f i >>= unsafeWrite marr (safeIndex (l,u) n i) | i <- range (l,u)]+newGenArray bnds f = do+    let n = safeRangeSize bnds+    marr <- unsafeNewArray_ bnds+    let g ix k i+            | i == n    = return ()+            | otherwise = do+                x <- f ix+                unsafeWrite marr i x+                k (i+1)+    foldr g (\ !_i -> return ()) (range bnds) 0+    -- The bang above is important for GHC for unbox the Int.     return marr  {-# INLINE readArray #-}@@ -945,7 +954,7 @@ {-# INLINE modifyArray #-} -- | Modify an element in a mutable array ----- @since FIXME+-- @since 0.5.6.0 modifyArray :: (MArray a e m, Ix i) => a i e -> i -> (e -> e) -> m () modifyArray marr i f = do   (l,u) <- getBounds marr@@ -957,7 +966,7 @@ {-# INLINE modifyArray' #-} -- | Modify an element in a mutable array. Strict in the written element. ----- @since FIXME+-- @since 0.5.6.0 modifyArray' :: (MArray a e m, Ix i) => a i e -> i -> (e -> e) -> m () modifyArray' marr i f = do   (l,u) <- getBounds marr
Data/Array/IO.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MagicHash, UnliftedFFITypes #-}+{-# LANGUAGE MagicHash, Trustworthy, UnliftedFFITypes #-}  ----------------------------------------------------------------------------- -- |
Data/Array/IO/Safe.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-}  ----------------------------------------------------------------------------- -- |
Data/Array/MArray.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, Trustworthy #-}  ----------------------------------------------------------------------------- -- |
Data/Array/ST.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE RankNTypes, Trustworthy #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.Array.ST
Data/Array/ST/Safe.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.Array.ST.Safe
Data/Array/Storable.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.Array.Storable
array.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.10 name:          array-version:       0.5.6.0+version:       0.5.7.0  -- NOTE: Don't forget to update ./changelog.md license:       BSD3@@ -36,7 +36,7 @@       Trustworthy,       UnboxedTuples,       UnliftedFFITypes-  build-depends: base >= 4.9 && < 4.20+  build-depends: base >= 4.9 && < 4.21   ghc-options: -Wall   exposed-modules:       Data.Array
changelog.md view
@@ -1,5 +1,12 @@ # Changelog for [`array` package](http://hackage.haskell.org/package/array) +## 0.5.7.0  *April 2024*++### Changed++  * `MArray` now has a `MINIMAL` pragma+  * Optimisation of `newListArray` and `newGenArray`+ ## 0.5.6.0  *July 2023*  ### Changed