Rename library to bytebuild. Use Data.Bytes namespace.
This commit is contained in:
parent
e9de3f30db
commit
1908d53a14
11 changed files with 46 additions and 36 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -1,7 +1,17 @@
|
||||||
# Revision history for small-bytearray-builder
|
# Revision history for bytebuild
|
||||||
|
|
||||||
|
Note: Prior to version 0.3.4.0, this library was named
|
||||||
|
`small-bytearray-builder`, not `bytebuild`. The library
|
||||||
|
`small-bytearray-builder` is now just a compatibility shim
|
||||||
|
to ease the migration process.
|
||||||
|
|
||||||
## 0.3.4.0 -- 2020-??-??
|
## 0.3.4.0 -- 2020-??-??
|
||||||
|
|
||||||
|
* Rename the library from `small-bytearray-builder` to `bytebuild`, and
|
||||||
|
move modules from the `Data.ByteArray` namespace to the `Data.Bytes`
|
||||||
|
namespace. This is not considered a breaking change since
|
||||||
|
`small-bytearray-builder` continues to exist as a compatibility shim,
|
||||||
|
reexporting the modules with their old names.
|
||||||
* Add `wordPaddedDec4`.
|
* Add `wordPaddedDec4`.
|
||||||
* Add `reversedOnto` and `commitsOntoChunks`.
|
* Add `reversedOnto` and `commitsOntoChunks`.
|
||||||
* Add `ascii(2|3|4|5|6)`.
|
* Add `ascii(2|3|4|5|6)`.
|
||||||
|
|
|
@ -7,8 +7,8 @@ import Gauge (bgroup,bench,whnf)
|
||||||
import Gauge.Main (defaultMain)
|
import Gauge.Main (defaultMain)
|
||||||
|
|
||||||
import qualified Arithmetic.Nat as Nat
|
import qualified Arithmetic.Nat as Nat
|
||||||
import qualified Data.ByteArray.Builder as B
|
import qualified Data.Bytes.Builder as B
|
||||||
import qualified Data.ByteArray.Builder.Bounded as U
|
import qualified Data.Bytes.Builder.Bounded as U
|
||||||
|
|
||||||
import qualified Cell
|
import qualified Cell
|
||||||
import qualified SimpleCsv
|
import qualified SimpleCsv
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Cell (Cell(..))
|
||||||
import Data.Primitive (SmallArray)
|
import Data.Primitive (SmallArray)
|
||||||
|
|
||||||
import qualified Data.Foldable as F
|
import qualified Data.Foldable as F
|
||||||
import qualified Data.ByteArray.Builder as B
|
import qualified Data.Bytes.Builder as B
|
||||||
|
|
||||||
encodeRows :: SmallArray (SmallArray Cell) -> B.Builder
|
encodeRows :: SmallArray (SmallArray Cell) -> B.Builder
|
||||||
encodeRows = F.foldr
|
encodeRows = F.foldr
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
cabal-version: 2.2
|
cabal-version: 2.2
|
||||||
name: small-bytearray-builder
|
name: bytebuild
|
||||||
version: 0.3.4.0
|
version: 0.3.4.0
|
||||||
synopsis: Serialize to a small byte arrays
|
synopsis: Serialize to a small byte arrays
|
||||||
description:
|
description:
|
||||||
|
@ -19,8 +19,8 @@ description:
|
||||||
of the next chunk. This strategy for building is suitable for most
|
of the next chunk. This strategy for building is suitable for most
|
||||||
CSVs and several line protocols (carbon, InfluxDB, etc.).
|
CSVs and several line protocols (carbon, InfluxDB, etc.).
|
||||||
|
|
||||||
homepage: https://github.com/byteverse/small-bytearray-builder
|
homepage: https://github.com/byteverse/bytebuild
|
||||||
bug-reports: https://github.com/byteverse/small-bytearray-builder/issues
|
bug-reports: https://github.com/byteverse/bytebuild/issues
|
||||||
license: BSD-3-Clause
|
license: BSD-3-Clause
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Andrew Martin
|
author: Andrew Martin
|
||||||
|
@ -36,10 +36,10 @@ flag checked
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
Data.ByteArray.Builder
|
Data.Bytes.Builder
|
||||||
Data.ByteArray.Builder.Unsafe
|
Data.Bytes.Builder.Unsafe
|
||||||
Data.ByteArray.Builder.Bounded
|
Data.Bytes.Builder.Bounded
|
||||||
Data.ByteArray.Builder.Bounded.Unsafe
|
Data.Bytes.Builder.Bounded.Unsafe
|
||||||
reexported-modules:
|
reexported-modules:
|
||||||
Data.Bytes.Chunks
|
Data.Bytes.Chunks
|
||||||
build-depends:
|
build-depends:
|
||||||
|
@ -72,13 +72,13 @@ test-suite test
|
||||||
build-depends:
|
build-depends:
|
||||||
, QuickCheck >=2.13.1 && <2.14
|
, QuickCheck >=2.13.1 && <2.14
|
||||||
, base >=4.12.0.0 && <5
|
, base >=4.12.0.0 && <5
|
||||||
|
, bytebuild
|
||||||
, byteslice
|
, byteslice
|
||||||
, bytestring
|
, bytestring
|
||||||
, natural-arithmetic
|
, natural-arithmetic
|
||||||
, primitive
|
, primitive
|
||||||
, primitive-unlifted >=0.1.2
|
, primitive-unlifted >=0.1.2
|
||||||
, quickcheck-classes >=0.6.4
|
, quickcheck-classes >=0.6.4
|
||||||
, small-bytearray-builder
|
|
||||||
, tasty >=1.2.3 && <1.3
|
, tasty >=1.2.3 && <1.3
|
||||||
, tasty-hunit >=0.10.0.2 && <0.11
|
, tasty-hunit >=0.10.0.2 && <0.11
|
||||||
, tasty-quickcheck >=0.10.1 && <0.11
|
, tasty-quickcheck >=0.10.1 && <0.11
|
||||||
|
@ -90,10 +90,10 @@ benchmark bench
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
build-depends:
|
build-depends:
|
||||||
, base
|
, base
|
||||||
|
, bytebuild
|
||||||
, gauge >= 0.2.4
|
, gauge >= 0.2.4
|
||||||
, natural-arithmetic
|
, natural-arithmetic
|
||||||
, primitive
|
, primitive
|
||||||
, small-bytearray-builder
|
|
||||||
, text-short
|
, text-short
|
||||||
, byteslice
|
, byteslice
|
||||||
ghc-options: -Wall -O2
|
ghc-options: -Wall -O2
|
|
@ -17,7 +17,7 @@ module HexWord64
|
||||||
|
|
||||||
import GHC.ST (ST(ST))
|
import GHC.ST (ST(ST))
|
||||||
import Data.Bits
|
import Data.Bits
|
||||||
import Data.ByteArray.Builder.Bounded.Unsafe (Builder,construct)
|
import Data.Bytes.Builder.Bounded.Unsafe (Builder,construct)
|
||||||
import Data.Primitive
|
import Data.Primitive
|
||||||
import Data.Word
|
import Data.Word
|
||||||
import GHC.Exts
|
import GHC.Exts
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Word16Tree
|
||||||
, expectedSmall
|
, expectedSmall
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.ByteArray.Builder as B
|
import Data.Bytes.Builder as B
|
||||||
import Data.Word (Word16)
|
import Data.Word (Word16)
|
||||||
import Data.Primitive (ByteArray)
|
import Data.Primitive (ByteArray)
|
||||||
import qualified Data.Bytes as Bytes
|
import qualified Data.Bytes as Bytes
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{-# language ScopedTypeVariables #-}
|
{-# language ScopedTypeVariables #-}
|
||||||
{-# language UnboxedTuples #-}
|
{-# language UnboxedTuples #-}
|
||||||
|
|
||||||
module Data.ByteArray.Builder
|
module Data.Bytes.Builder
|
||||||
( -- * Bounded Primitives
|
( -- * Bounded Primitives
|
||||||
Builder
|
Builder
|
||||||
, fromBounded
|
, fromBounded
|
||||||
|
@ -117,13 +117,13 @@ module Data.ByteArray.Builder
|
||||||
import Control.Exception (SomeException,toException)
|
import Control.Exception (SomeException,toException)
|
||||||
import Control.Monad.ST (ST,runST)
|
import Control.Monad.ST (ST,runST)
|
||||||
import Control.Monad.IO.Class (MonadIO,liftIO)
|
import Control.Monad.IO.Class (MonadIO,liftIO)
|
||||||
import Data.ByteArray.Builder.Unsafe (Builder(Builder))
|
import Data.Bytes.Builder.Unsafe (Builder(Builder))
|
||||||
import Data.ByteArray.Builder.Unsafe (BuilderState(BuilderState),pasteIO)
|
import Data.Bytes.Builder.Unsafe (BuilderState(BuilderState),pasteIO)
|
||||||
import Data.ByteArray.Builder.Unsafe (Commits(Initial,Mutable,Immutable))
|
import Data.Bytes.Builder.Unsafe (Commits(Initial,Mutable,Immutable))
|
||||||
import Data.ByteArray.Builder.Unsafe (reverseCommitsOntoChunks)
|
import Data.Bytes.Builder.Unsafe (reverseCommitsOntoChunks)
|
||||||
import Data.ByteArray.Builder.Unsafe (commitsOntoChunks)
|
import Data.Bytes.Builder.Unsafe (commitsOntoChunks)
|
||||||
import Data.ByteArray.Builder.Unsafe (stringUtf8,cstring)
|
import Data.Bytes.Builder.Unsafe (stringUtf8,cstring)
|
||||||
import Data.ByteArray.Builder.Unsafe (addCommitsLength,copyReverseCommits)
|
import Data.Bytes.Builder.Unsafe (addCommitsLength,copyReverseCommits)
|
||||||
import Data.ByteString.Short.Internal (ShortByteString(SBS))
|
import Data.ByteString.Short.Internal (ShortByteString(SBS))
|
||||||
import Data.Bytes.Chunks (Chunks(ChunksNil))
|
import Data.Bytes.Chunks (Chunks(ChunksNil))
|
||||||
import Data.Bytes.Types (Bytes(Bytes),MutableBytes(MutableBytes))
|
import Data.Bytes.Types (Bytes(Bytes),MutableBytes(MutableBytes))
|
||||||
|
@ -143,8 +143,8 @@ import GHC.ST (ST(ST))
|
||||||
|
|
||||||
import qualified Arithmetic.Nat as Nat
|
import qualified Arithmetic.Nat as Nat
|
||||||
import qualified Arithmetic.Types as Arithmetic
|
import qualified Arithmetic.Types as Arithmetic
|
||||||
import qualified Data.ByteArray.Builder.Bounded as Bounded
|
import qualified Data.Bytes.Builder.Bounded as Bounded
|
||||||
import qualified Data.ByteArray.Builder.Bounded.Unsafe as UnsafeBounded
|
import qualified Data.Bytes.Builder.Bounded.Unsafe as UnsafeBounded
|
||||||
import qualified Data.Primitive as PM
|
import qualified Data.Primitive as PM
|
||||||
import qualified Data.Text.Short as TS
|
import qualified Data.Text.Short as TS
|
||||||
import qualified GHC.Exts as Exts
|
import qualified GHC.Exts as Exts
|
||||||
|
@ -231,7 +231,7 @@ putMany hint0 g xs cb = do
|
||||||
putManyError :: SomeException
|
putManyError :: SomeException
|
||||||
{-# noinline putManyError #-}
|
{-# noinline putManyError #-}
|
||||||
putManyError = toException
|
putManyError = toException
|
||||||
(userError "small-bytearray-builder: putMany implementation error")
|
(userError "bytebuild: putMany implementation error")
|
||||||
|
|
||||||
-- | Variant of 'putMany' that prefixes each pushed array of chunks
|
-- | Variant of 'putMany' that prefixes each pushed array of chunks
|
||||||
-- with the number of bytes that the chunks in each batch required.
|
-- with the number of bytes that the chunks in each batch required.
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
-- | The functions in this module are explict about the maximum number
|
-- | The functions in this module are explict about the maximum number
|
||||||
-- of bytes they require.
|
-- of bytes they require.
|
||||||
module Data.ByteArray.Builder.Bounded
|
module Data.Bytes.Builder.Bounded
|
||||||
( -- * Builder
|
( -- * Builder
|
||||||
Builder
|
Builder
|
||||||
-- * Execute
|
-- * Execute
|
||||||
|
@ -98,7 +98,7 @@ import Control.Monad.Primitive
|
||||||
import Control.Monad.ST (ST)
|
import Control.Monad.ST (ST)
|
||||||
import Control.Monad.ST.Run (runByteArrayST)
|
import Control.Monad.ST.Run (runByteArrayST)
|
||||||
import Data.Bits
|
import Data.Bits
|
||||||
import Data.ByteArray.Builder.Bounded.Unsafe (Builder(..))
|
import Data.Bytes.Builder.Bounded.Unsafe (Builder(..))
|
||||||
import Data.Char (ord)
|
import Data.Char (ord)
|
||||||
import Data.Primitive
|
import Data.Primitive
|
||||||
import Data.Primitive.ByteArray.Offset (MutableByteArrayOffset(..))
|
import Data.Primitive.ByteArray.Offset (MutableByteArrayOffset(..))
|
||||||
|
@ -112,7 +112,7 @@ import GHC.Word (Word8(W8#),Word16(W16#),Word32(W32#),Word64(W64#))
|
||||||
import qualified Arithmetic.Lte as Lte
|
import qualified Arithmetic.Lte as Lte
|
||||||
import qualified Arithmetic.Nat as Nat
|
import qualified Arithmetic.Nat as Nat
|
||||||
import qualified Arithmetic.Types as Arithmetic
|
import qualified Arithmetic.Types as Arithmetic
|
||||||
import qualified Data.ByteArray.Builder.Bounded.Unsafe as Unsafe
|
import qualified Data.Bytes.Builder.Bounded.Unsafe as Unsafe
|
||||||
import qualified Data.Primitive as PM
|
import qualified Data.Primitive as PM
|
||||||
|
|
||||||
-- | Execute the bounded builder. If the size is a constant,
|
-- | Execute the bounded builder. If the size is a constant,
|
|
@ -6,7 +6,7 @@
|
||||||
{-# language ScopedTypeVariables #-}
|
{-# language ScopedTypeVariables #-}
|
||||||
{-# language UnboxedTuples #-}
|
{-# language UnboxedTuples #-}
|
||||||
|
|
||||||
module Data.ByteArray.Builder.Bounded.Unsafe
|
module Data.Bytes.Builder.Bounded.Unsafe
|
||||||
( -- * Types
|
( -- * Types
|
||||||
Builder(..)
|
Builder(..)
|
||||||
-- * Construct
|
-- * Construct
|
|
@ -6,7 +6,7 @@
|
||||||
{-# language ScopedTypeVariables #-}
|
{-# language ScopedTypeVariables #-}
|
||||||
{-# language UnboxedTuples #-}
|
{-# language UnboxedTuples #-}
|
||||||
|
|
||||||
module Data.ByteArray.Builder.Unsafe
|
module Data.Bytes.Builder.Unsafe
|
||||||
( -- * Types
|
( -- * Types
|
||||||
Builder(..)
|
Builder(..)
|
||||||
, BuilderState(..)
|
, BuilderState(..)
|
||||||
|
@ -24,7 +24,7 @@ module Data.ByteArray.Builder.Unsafe
|
||||||
-- * Safe Functions
|
-- * Safe Functions
|
||||||
-- | These functions are actually completely safe, but they are defined
|
-- | These functions are actually completely safe, but they are defined
|
||||||
-- here because they are used by typeclass instances. Import them from
|
-- here because they are used by typeclass instances. Import them from
|
||||||
-- @Data.ByteArray.Builder@ instead.
|
-- @Data.Bytes.Builder@ instead.
|
||||||
, stringUtf8
|
, stringUtf8
|
||||||
, cstring
|
, cstring
|
||||||
) where
|
) where
|
||||||
|
@ -41,8 +41,8 @@ import GHC.Exts (RealWorld,IsString,Int#,State#)
|
||||||
import GHC.ST (ST(ST))
|
import GHC.ST (ST(ST))
|
||||||
import GHC.IO (stToIO)
|
import GHC.IO (stToIO)
|
||||||
|
|
||||||
import qualified Data.ByteArray.Builder.Bounded as Bounded
|
import qualified Data.Bytes.Builder.Bounded as Bounded
|
||||||
import qualified Data.ByteArray.Builder.Bounded.Unsafe as UnsafeBounded
|
import qualified Data.Bytes.Builder.Bounded.Unsafe as UnsafeBounded
|
||||||
import qualified Data.Primitive as PM
|
import qualified Data.Primitive as PM
|
||||||
import qualified GHC.Exts as Exts
|
import qualified GHC.Exts as Exts
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Control.Applicative (liftA2)
|
import Control.Applicative (liftA2)
|
||||||
import Control.Monad.ST (runST)
|
import Control.Monad.ST (runST)
|
||||||
import Data.ByteArray.Builder
|
import Data.Bytes.Builder
|
||||||
import Data.Bytes.Types (MutableBytes(MutableBytes))
|
import Data.Bytes.Types (MutableBytes(MutableBytes))
|
||||||
import Data.Primitive (PrimArray)
|
import Data.Primitive (PrimArray)
|
||||||
import Data.Word
|
import Data.Word
|
||||||
|
@ -21,7 +21,7 @@ import Text.Printf (printf)
|
||||||
import Test.Tasty.HUnit ((@=?))
|
import Test.Tasty.HUnit ((@=?))
|
||||||
|
|
||||||
import qualified Arithmetic.Nat as Nat
|
import qualified Arithmetic.Nat as Nat
|
||||||
import qualified Data.ByteArray.Builder.Bounded as Bounded
|
import qualified Data.Bytes.Builder.Bounded as Bounded
|
||||||
import qualified Data.ByteString as ByteString
|
import qualified Data.ByteString as ByteString
|
||||||
import qualified Data.ByteString.Builder as BB
|
import qualified Data.ByteString.Builder as BB
|
||||||
import qualified Data.ByteString.Lazy.Char8 as LB
|
import qualified Data.ByteString.Lazy.Char8 as LB
|
||||||
|
|
Loading…
Reference in a new issue