diff options
author | Bodigrim <andrew.lelechenko@gmail.com> | 2021-10-12 21:43:18 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-26 16:01:09 -0500 |
commit | ff0c45f367ff6e978e9f48cfce7ab5d6ceebb1d5 (patch) | |
tree | b700e774b69e632da1c89735185eebf114ff958e /libraries/base | |
parent | e2c48b98c6a201eae09b4c84e73bb77608d03ec8 (diff) | |
download | haskell-ff0c45f367ff6e978e9f48cfce7ab5d6ceebb1d5.tar.gz |
Rename Data.ByteArray to Data.Array.ByteArray + add Trustworthy
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/Data/Array/ByteArray.hs (renamed from libraries/base/Data/ByteArray.hs) | 13 | ||||
-rw-r--r-- | libraries/base/base.cabal | 2 | ||||
-rw-r--r-- | libraries/base/changelog.md | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/libraries/base/Data/ByteArray.hs b/libraries/base/Data/Array/ByteArray.hs index 47562c0ce7..18b0f5b2ec 100644 --- a/libraries/base/Data/ByteArray.hs +++ b/libraries/base/Data/Array/ByteArray.hs @@ -1,5 +1,5 @@ -- | --- Module : Data.ByteArray +-- Module : Data.Array.ByteArray -- Copyright : (c) Roman Leshchinskiy 2009-2012 -- License : BSD-style -- @@ -11,9 +11,10 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE Trustworthy #-} {-# LANGUAGE UnboxedTuples #-} -module Data.ByteArray ( +module Data.Array.ByteArray ( ByteArray(..) ) where @@ -91,12 +92,12 @@ byteArrayFromListN n ys = runST $ do marr <- newByteArray n let go !ix [] = if ix == n then return () - else error $ "Data.ByteArray.byteArrayFromListN: list length less than specified size" + else error $ "Data.Array.ByteArray.byteArrayFromListN: list length less than specified size" go !ix (x : xs) = if ix < n then do writeByteArray marr ix x go (ix + 1) xs - else error $ "Data.ByteArray.byteArrayFromListN: list length greater than specified size" + else error $ "Data.Array.ByteArray.byteArrayFromListN: list length greater than specified size" go 0 ys unsafeFreezeByteArray marr @@ -118,7 +119,7 @@ copyByteArray (MutableByteArray dst#) (I# doff#) (ByteArray src#) (I# soff#) (I# instance Data ByteArray where toConstr _ = error "toConstr" gunfold _ _ = error "gunfold" - dataTypeOf _ = mkNoRepType "Data.ByteArray.ByteArray" + dataTypeOf _ = mkNoRepType "Data.Array.ByteArray.ByteArray" instance Show ByteArray where showsPrec _ ba = @@ -227,7 +228,7 @@ instance Semigroup ByteArray where stimes i arr | itgr < 1 = emptyByteArray | itgr <= (fromIntegral (maxBound :: Int)) = replicateByteArray (fromIntegral itgr) arr - | otherwise = error "Data.ByteArray#stimes: cannot allocate the requested amount of memory" + | otherwise = error "Data.Array.ByteArray#stimes: cannot allocate the requested amount of memory" where itgr = toInteger i :: Integer instance Monoid ByteArray where diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index 0f7023ae79..5d9a145421 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -113,12 +113,12 @@ Library Control.Monad.ST.Strict Control.Monad.ST.Unsafe Control.Monad.Zip + Data.Array.ByteArray Data.Bifoldable Data.Bifunctor Data.Bitraversable Data.Bits Data.Bool - Data.ByteArray Data.Char Data.Coerce Data.Complex diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index e1a21989ff..422e8cdd2c 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -12,7 +12,7 @@ * Introduce `GHC.ExecutablePath.executablePath`, which is more robust than `getExecutablePath` in cases when the executable has been deleted. - * Add `Data.ByteArray` module, providing a boxed `ByteArray#`. + * Add `Data.Array.ByteArray` module, providing a boxed `ByteArray#`. * `fromEnum` for `Natural` now throws an error for any number that cannot be repesented exactly by an `Int` (#20291). |