packages feed

array 0.5.0.0 → 0.5.1.0

raw patch · 7 files changed

+125/−42 lines, 7 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.MArray: class Monad m => MArray a e m where newArray (l, u) initialValue = do { let n = safeRangeSize (l, u); marr <- unsafeNewArray_ (l, u); sequence_ [unsafeWrite marr i initialValue | i <- [0 .. n - 1]]; return marr } unsafeNewArray_ (l, u) = newArray (l, u) arrEleBottom newArray_ (l, u) = newArray (l, u) arrEleBottom
+ Data.Array.MArray: class (Monad m) => MArray a e m where newArray (l, u) initialValue = do { let n = safeRangeSize (l, u); marr <- unsafeNewArray_ (l, u); sequence_ [unsafeWrite marr i initialValue | i <- [0 .. n - 1]]; return marr } unsafeNewArray_ (l, u) = newArray (l, u) arrEleBottom newArray_ (l, u) = newArray (l, u) arrEleBottom
- Data.Array.MArray.Safe: class Monad m => MArray a e m where newArray (l, u) initialValue = do { let n = safeRangeSize (l, u); marr <- unsafeNewArray_ (l, u); sequence_ [unsafeWrite marr i initialValue | i <- [0 .. n - 1]]; return marr } unsafeNewArray_ (l, u) = newArray (l, u) arrEleBottom newArray_ (l, u) = newArray (l, u) arrEleBottom
+ Data.Array.MArray.Safe: class (Monad m) => MArray a e m where newArray (l, u) initialValue = do { let n = safeRangeSize (l, u); marr <- unsafeNewArray_ (l, u); sequence_ [unsafeWrite marr i initialValue | i <- [0 .. n - 1]]; return marr } unsafeNewArray_ (l, u) = newArray (l, u) arrEleBottom newArray_ (l, u) = newArray (l, u) arrEleBottom

Files

Data/Array/Base.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE BangPatterns, CPP, RankNTypes, MagicHash, UnboxedTuples, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, DeriveDataTypeable, UnliftedFFITypes #-}+#if __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE RoleAnnotations #-}+#endif {-# OPTIONS_HADDOCK hide #-}  -----------------------------------------------------------------------------@@ -29,8 +32,9 @@ import qualified GHC.Arr as Arr import qualified GHC.Arr as ArrST import GHC.ST           ( ST(..), runST )-import GHC.Base-import GHC.Ptr          ( Ptr(..), FunPtr(..), nullPtr, nullFunPtr )+import GHC.Base         ( IO(..) )+import GHC.Exts+import GHC.Ptr          ( nullPtr, nullFunPtr ) import GHC.Stable       ( StablePtr(..) ) #if !MIN_VERSION_base(4,6,0) import GHC.Exts         ( Word(..) )@@ -401,6 +405,10 @@ -- data UArray i e = UArray !i !i !Int ByteArray#                   deriving Typeable+#if __GLASGOW_HASKELL__ >= 708+-- There are class-based invariants on both parameters. See also #9220.+type role UArray nominal nominal+#endif  {-# INLINE unsafeArrayUArray #-} unsafeArrayUArray :: (MArray (STUArray s) e (ST s), Ix i)@@ -984,6 +992,11 @@ -- 'STArray' provides. data STUArray s i e = STUArray !i !i !Int (MutableByteArray# s)                       deriving Typeable+#if __GLASGOW_HASKELL__ >= 708+-- The "ST" parameter must be nominal for the safety of the ST trick.+-- The other parameters have class constraints. See also #9220.+type role STUArray nominal nominal nominal+#endif  instance Eq (STUArray s i e) where     STUArray _ _ _ arr1# == STUArray _ _ _ arr2# =@@ -1377,7 +1390,11 @@   -- use the safe array creation function here.   return (listArray (l,u) es) +#if __GLASGOW_HASKELL__ >= 711+freezeSTUArray :: STUArray s i e -> ST s (UArray i e)+#else freezeSTUArray :: Ix i => STUArray s i e -> ST s (UArray i e)+#endif freezeSTUArray (STUArray l u n marr#) = ST $ \s1# ->     case sizeofMutableByteArray# marr#  of { n# ->     case newByteArray# n# s1#           of { (# s2#, marr'# #) ->@@ -1452,7 +1469,11 @@               | i <- [0 .. n - 1]]     return marr +#if __GLASGOW_HASKELL__ >= 711+thawSTUArray :: UArray i e -> ST s (STUArray s i e)+#else thawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e)+#endif thawSTUArray (UArray l u n arr#) = ST $ \s1# ->     case sizeofByteArray# arr#          of { n# ->     case newByteArray# n# s1#           of { (# s2#, marr# #) ->@@ -1512,7 +1533,11 @@ unsafeThaw = thaw  {-# INLINE unsafeThawSTUArray #-}+#if __GLASGOW_HASKELL__ >= 711+unsafeThawSTUArray :: UArray i e -> ST s (STUArray s i e)+#else unsafeThawSTUArray :: Ix i => UArray i e -> ST s (STUArray s i e)+#endif unsafeThawSTUArray (UArray l u n marr#) =     return (STUArray l u n (unsafeCoerce# marr#)) @@ -1522,7 +1547,11 @@     #-}  {-# INLINE unsafeThawIOArray #-}+#if __GLASGOW_HASKELL__ >= 711+unsafeThawIOArray :: Arr.Array ix e -> IO (IOArray ix e)+#else unsafeThawIOArray :: Ix ix => Arr.Array ix e -> IO (IOArray ix e)+#endif unsafeThawIOArray arr = stToIO $ do     marr <- ArrST.unsafeThawSTArray arr     return (IOArray marr)@@ -1531,7 +1560,11 @@ "unsafeThaw/IOArray"  unsafeThaw = unsafeThawIOArray     #-} +#if __GLASGOW_HASKELL__ >= 711+thawIOArray :: Arr.Array ix e -> IO (IOArray ix e)+#else thawIOArray :: Ix ix => Arr.Array ix e -> IO (IOArray ix e)+#endif thawIOArray arr = stToIO $ do     marr <- ArrST.thawSTArray arr     return (IOArray marr)@@ -1540,7 +1573,11 @@ "thaw/IOArray"  thaw = thawIOArray     #-} +#if __GLASGOW_HASKELL__ >= 711+freezeIOArray :: IOArray ix e -> IO (Arr.Array ix e)+#else freezeIOArray :: Ix ix => IOArray ix e -> IO (Arr.Array ix e)+#endif freezeIOArray (IOArray marr) = stToIO (ArrST.freezeSTArray marr)  {-# RULES@@ -1548,7 +1585,11 @@     #-}  {-# INLINE unsafeFreezeIOArray #-}+#if __GLASGOW_HASKELL__ >= 711+unsafeFreezeIOArray :: IOArray ix e -> IO (Arr.Array ix e)+#else unsafeFreezeIOArray :: Ix ix => IOArray ix e -> IO (Arr.Array ix e)+#endif unsafeFreezeIOArray (IOArray marr) = stToIO (ArrST.unsafeFreezeSTArray marr)  {-# RULES
Data/Array/IO/Internals.hs view
@@ -1,4 +1,9 @@-{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses,+             CPP #-}+#if __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE RoleAnnotations #-}+#endif+ {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- |@@ -29,7 +34,9 @@ import Foreign.Ptr              ( Ptr, FunPtr ) import Foreign.StablePtr        ( StablePtr ) +#if __GLASGOW_HASKELL__ < 711 import Data.Ix+#endif import Data.Array.Base  import GHC.IOArray (IOArray(..))@@ -47,6 +54,10 @@ -- newtype IOUArray i e = IOUArray (STUArray RealWorld i e)                        deriving Typeable+#if __GLASGOW_HASKELL__ >= 708+-- Both parameters have class-based invariants. See also #9220.+type role IOUArray nominal nominal+#endif  instance Eq (IOUArray i e) where     IOUArray s1 == IOUArray s2  =  s1 == s2@@ -366,7 +377,11 @@     return (IOUArray marr')  {-# INLINE unsafeThawIOUArray #-}+#if __GLASGOW_HASKELL__ >= 711+unsafeThawIOUArray :: UArray ix e -> IO (IOUArray ix e)+#else unsafeThawIOUArray :: Ix ix => UArray ix e -> IO (IOUArray ix e)+#endif unsafeThawIOUArray arr = stToIO $ do     marr <- unsafeThawSTUArray arr     return (IOUArray marr)@@ -375,7 +390,11 @@ "unsafeThaw/IOUArray" unsafeThaw = unsafeThawIOUArray     #-} +#if __GLASGOW_HASKELL__ >= 711+thawIOUArray :: UArray ix e -> IO (IOUArray ix e)+#else thawIOUArray :: Ix ix => UArray ix e -> IO (IOUArray ix e)+#endif thawIOUArray arr = stToIO $ do     marr <- thawSTUArray arr     return (IOUArray marr)@@ -385,14 +404,22 @@     #-}  {-# INLINE unsafeFreezeIOUArray #-}+#if __GLASGOW_HASKELL__ >= 711+unsafeFreezeIOUArray :: IOUArray ix e -> IO (UArray ix e)+#else unsafeFreezeIOUArray :: Ix ix => IOUArray ix e -> IO (UArray ix e)+#endif unsafeFreezeIOUArray (IOUArray marr) = stToIO (unsafeFreezeSTUArray marr)  {-# RULES "unsafeFreeze/IOUArray" unsafeFreeze = unsafeFreezeIOUArray     #-} +#if __GLASGOW_HASKELL__ >= 711+freezeIOUArray :: IOUArray ix e -> IO (UArray ix e)+#else freezeIOUArray :: Ix ix => IOUArray ix e -> IO (UArray ix e)+#endif freezeIOUArray (IOUArray marr) = stToIO (freezeSTUArray marr)  {-# RULES
Data/Array/ST.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- -- |@@ -37,9 +38,11 @@ -- the array before returning it - it uses 'unsafeFreeze' internally, but -- this wrapper is a safe interface to that function. ---runSTArray :: (Ix i)-           => (forall s . ST s (STArray s i e))-           -> Array i e+#if __GLASGOW_HASKELL__ >= 711+runSTArray :: (forall s . ST s (STArray s i e)) -> Array i e+#else+runSTArray :: Ix i => (forall s . ST s (STArray s i e)) -> Array i e+#endif runSTArray st = runST (st >>= unsafeFreezeSTArray)  -- | A safe way to create and work with an unboxed mutable array before@@ -48,9 +51,11 @@ -- 'unsafeFreeze' internally, but this wrapper is a safe interface to -- that function. ---runSTUArray :: (Ix i)-           => (forall s . ST s (STUArray s i e))-           -> UArray i e+#if __GLASGOW_HASKELL__ >= 711+runSTUArray :: (forall s . ST s (STUArray s i e)) -> UArray i e+#else+runSTUArray :: Ix i => (forall s . ST s (STUArray s i e)) -> UArray i e+#endif runSTUArray st = runST (st >>= unsafeFreezeSTUArray)  
Data/Array/Storable/Internals.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, CPP #-}+#if __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE RoleAnnotations #-}+#endif {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- |@@ -28,6 +31,10 @@  -- |The array type data StorableArray i e = StorableArray !i !i Int !(ForeignPtr e)+#if __GLASGOW_HASKELL__ >= 708+-- Both parameters have class-based invariants. See also #9220.+type role StorableArray nominal nominal+#endif  instance Storable e => MArray StorableArray e IO where     getBounds (StorableArray l u _ _) = return (l,u)
array.cabal view
@@ -1,6 +1,6 @@ name:          array-version:       0.5.0.0--- GHC 7.6.1 released with 0.4.0.1+version:       0.5.1.0+-- NOTE: Don't forget to update ./changelog.md license:       BSD3 license-file:  LICENSE maintainer:    libraries@haskell.org@@ -17,17 +17,12 @@     immutable arrays and 'MArray' of arrays mutable within appropriate     monads, as well as some instances of these classes. -extra-source-files: changelog+extra-source-files: changelog.md  source-repository head   type:     git   location: http://git.haskell.org/packages/array.git -source-repository this-  type:     git-  location: http://git.haskell.org/packages/array.git-  tag:      array-0.5.0.0-release- library   default-language: Haskell2010   other-extensions:@@ -42,7 +37,7 @@       Trustworthy,       UnboxedTuples,       UnliftedFFITypes-  build-depends: base >= 4.5 && < 4.8+  build-depends: base >= 4.5 && < 4.9   ghc-options: -Wall   exposed-modules:       Data.Array
− changelog
@@ -1,23 +0,0 @@--*-change-log-*---0.5.0.0  Nov 2013-        * Update to Cabal 1.10 format-        * Remove NHC and Hugs specific code-        * Remove deprecated function exports `Data.Array.IO.castIOUArray`,-        `Data.Array.MArray.unsafeFreeze`, `Data.Array.MArray.unsafeThaw`,-        and `Data.Array.ST.castSTUArray`; These functions are still-        available from the "Data.Array.Unsafe" module.--0.4.0.1  Sep 2012-        * Bundled with GHC 7.6.1-        * Fix inline rule shadowing warnings--0.4.0.0  Feb 2012-        * Bundled with GHC 7.4.1-        * Add support for SafeHaskell-        * New "Data.Array.IO.Safe" module-        * New "Data.Array.MArray.safe" module-        * New "Data.Array.ST.safe" module-        * New "Data.Array.Storable.Internals" module-        * New "Data.Array.Storable.Safe" module-        * New "Data.Array.Unsafe" module
+ changelog.md view
@@ -0,0 +1,31 @@+# Changelog for [`array` package](http://hackage.haskell.org/package/array)++## 0.5.1.0  *Mar 2015*++  * Bundled with GHC 7.10.1+  * Add role annotations for GHC >= 7.8 (#9220)++## 0.5.0.0  *Nov 2013*++  * Update to Cabal 1.10 format+  * Remove NHC and Hugs specific code+  * Remove deprecated function exports `Data.Array.IO.castIOUArray`,+    `Data.Array.MArray.unsafeFreeze`, `Data.Array.MArray.unsafeThaw`,+    and `Data.Array.ST.castSTUArray`; These functions are still+    available from the `Data.Array.Unsafe` module.++## 0.4.0.1  *Sep 2012*++  * Bundled with GHC 7.6.1+  * Fix inline rule shadowing warnings++## 0.4.0.0  *Feb 2012*++  * Bundled with GHC 7.4.1+  * Add support for SafeHaskell+  * New `Data.Array.IO.Safe` module+  * New `Data.Array.MArray.safe` module+  * New `Data.Array.ST.safe` module+  * New `Data.Array.Storable.Internals` module+  * New `Data.Array.Storable.Safe` module+  * New `Data.Array.Unsafe` module