text-builder-linear 0.1.1 → 0.1.1.1
raw patch · 3 files changed
+21/−18 lines, 3 filesdep ~bytestringdep ~text
Dependency ranges changed: bytestring, text
Files
- changelog.md +4/−0
- src/Data/Text/Builder/Linear/Core.hs +13/−14
- text-builder-linear.cabal +4/−4
changelog.md view
@@ -1,3 +1,7 @@+## 0.1.1.1++* Support `text-2.1`.+ ## 0.1.1 * Introduce `ByteString` backend (thanks @oberblastmeister for the idea).
src/Data/Text/Builder/Linear/Core.hs view
@@ -24,7 +24,6 @@ import Data.ByteString.Internal (ByteString (..)) import Data.Text qualified as T-import Data.Text.Array (Array (..), MArray (..)) import Data.Text.Array qualified as A import Data.Text.Internal (Text (..)) import GHC.Exts (Int (..), Levity (..), RuntimeRep (..), TYPE, byteArrayContents#, isByteArrayPinned#, isTrue#, plusAddr#, sizeofByteArray#, unsafeCoerce#)@@ -88,7 +87,7 @@ -- | Same as 'runBuffer', but returning a UTF-8 encoded strict 'ByteString'. runBufferBS ∷ (Buffer ⊸ Buffer) ⊸ ByteString runBufferBS f = case shrinkBuffer (f (Buffer memptyPinned)) of- Buffer (Text (ByteArray arr) (I# from) len) → BS fp len+ Buffer (Text (A.ByteArray arr) (I# from) len) → BS fp len where addr# = byteArrayContents# arr `plusAddr#` from fp = ForeignPtr addr# (PlainPtr (unsafeCoerce# arr))@@ -180,7 +179,7 @@ appendBounded ∷ Int -- ^ Upper bound for the number of bytes, written by an action- → (∀ s. MArray s → Int → ST s Int)+ → (∀ s. A.MArray s → Int → ST s Int) -- ^ Action, which writes bytes __starting__ from the given offset -- and returns an actual number of bytes written. → Buffer@@ -204,7 +203,7 @@ appendExact ∷ Int -- ^ Exact number of bytes, written by an action- → (∀ s. MArray s → Int → ST s ())+ → (∀ s. A.MArray s → Int → ST s ()) -- ^ Action, which writes bytes __starting__ from the given offset → Buffer ⊸ Buffer@@ -218,10 +217,10 @@ prependBounded ∷ Int -- ^ Upper bound for the number of bytes, written by an action- → (∀ s. MArray s → Int → ST s Int)+ → (∀ s. A.MArray s → Int → ST s Int) -- ^ Action, which writes bytes __finishing__ before the given offset -- and returns an actual number of bytes written.- → (∀ s. MArray s → Int → ST s Int)+ → (∀ s. A.MArray s → Int → ST s Int) -- ^ Action, which writes bytes __starting__ from the given offset -- and returns an actual number of bytes written. → Buffer@@ -247,7 +246,7 @@ prependExact ∷ Int -- ^ Exact number of bytes, written by an action- → (∀ s. MArray s → Int → ST s ())+ → (∀ s. A.MArray s → Int → ST s ()) -- ^ Action, which writes bytes __starting__ from the given offset → Buffer ⊸ Buffer@@ -258,15 +257,15 @@ (\dst dstOff → appender dst dstOff >> pure srcLen) {-# INLINE prependExact #-} -unsafeThaw ∷ Array → ST s (MArray s)-unsafeThaw (ByteArray a) = ST $ \s# →- (# s#, MutableByteArray (unsafeCoerce# a) #)+unsafeThaw ∷ A.Array → ST s (A.MArray s)+unsafeThaw (A.ByteArray a) = ST $ \s# →+ (# s#, A.MutableByteArray (unsafeCoerce# a) #) -sizeofByteArray ∷ Array → Int-sizeofByteArray (ByteArray a) = I# (sizeofByteArray# a)+sizeofByteArray ∷ A.Array → Int+sizeofByteArray (A.ByteArray a) = I# (sizeofByteArray# a) -isPinned ∷ Array → Bool-isPinned (ByteArray a) = isTrue# (isByteArrayPinned# a)+isPinned ∷ A.Array → Bool+isPinned (A.ByteArray a) = isTrue# (isByteArrayPinned# a) -- | Concatenate two 'Buffer's, potentially mutating both of them. --
text-builder-linear.cabal view
@@ -1,12 +1,12 @@ cabal-version: 2.4 name: text-builder-linear-version: 0.1.1+version: 0.1.1.1 license: BSD-3-Clause license-file: LICENSE copyright: 2022 Andrew Lelechenko maintainer: Andrew Lelechenko <andrew.lelechenko@gmail.com> author: Andrew Lelechenko-tested-with: ghc ==9.2.7 ghc ==9.4.4 ghc ==9.6.1+tested-with: ghc ==9.2.8 ghc ==9.4.7 ghc ==9.6.2 ghc ==9.8.1 homepage: https://github.com/Bodigrim/linear-builder synopsis: Builder for Text and ByteString based on linear types description:@@ -43,8 +43,8 @@ ghc-options: -Wall -O2 -fexpose-all-unfoldings build-depends: base >=4.16 && <5,- text >=2.0 && <2.1,- bytestring >=0.11 && <0.12,+ text >=2.0 && <2.2,+ bytestring >=0.11 && <0.13, quote-quot >=0.2.1 && <0.3 test-suite linear-builder-tests