Skip to content

Commit

Permalink
Update changelog and @since annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysxia committed Oct 26, 2024
1 parent b4d7ce5 commit 7524c19
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
32 changes: 31 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
### 2.1.2
### 2.2

* [Update case mappings for Unicode 16.0](https://github.com/haskell/text/pull/618)

* [Add type synonym for lazy builders. Deprecated `StrictBuilder` for `StrictTextBuilder`](https://github.com/haskell/text/pull/581)

* [Add `initsNE` and `tailsNE`](https://github.com/haskell/text/pull/558)

* [Add `foldlM'`](https://github.com/haskell/text/pull/543)

* [Add `Data.Text.Foreign.peekCString`](https://github.com/haskell/text/pull/599)

* [Add `Data.Text.show` and `Data.Text.Lazy.show`](https://github.com/haskell/text/pull/608)

* [Add pattern synonyms `Empty`, `(:<)`, and `(:>)`](https://github.com/haskell/text/pull/619)

* [Improve precision of `Data.Text.Read.rational`](https://github.com/haskell/text/pull/565)

* [`Data.Text.IO.Utf8`: use `B.putStrLn` instead of `B.putStr t >> B.putStr "\n"`](https://github.com/haskell/text/pull/579)

* [`Data.Text.IO` and `Data.Text.Lazy.IO`: Make `putStrLn` more atomic with line or block buffering](https://github.com/haskell/text/pull/600)

* [Integrate UTF-8 `hPutStr` to standard `hPutStr`](https://github.com/haskell/text/pull/589)

* [Serialise `Text` without going through `ByteString`](https://github.com/haskell/text/pull/617)

* [Make `splitAt` strict in its first argument](https://github.com/haskell/text/pull/575)

* [Improve lazy performance of `Data.Text.Lazy.inits`](https://github.com/haskell/text/pull/572)

* [Implement `Data.Text.unpack` and `Data.Text.toTitle` directly, without streaming](https://github.com/haskell/text/pull/611)

* [Make `fromString` `INLINEABLE` instead of `INLINE`](https://github.com/haskell/text/pull/571) to reduce the size of generated code.

### 2.1.1

* Add pure Haskell implementations as an alternative to C-based ones,
Expand Down
14 changes: 9 additions & 5 deletions src/Data/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,15 @@ null (Text _arr _off len) =
-- | Bidirectional pattern synonym for 'empty' and 'null' (both /O(1)/),
-- to be used together with '(:<)' or '(:>)'.
--
-- @since 2.1.2
-- @since 2.2
pattern Empty :: Text
pattern Empty <- (null -> True) where
Empty = empty

-- | Bidirectional pattern synonym for 'cons' (/O(n)/) and 'uncons' (/O(1)/),
-- to be used together with 'Empty'.
--
-- @since 2.1.2
-- @since 2.2
pattern (:<) :: Char -> Text -> Text
pattern x :< xs <- (uncons -> Just (x, xs)) where
(:<) = cons
Expand All @@ -593,7 +593,7 @@ infixr 5 :<
-- | Bidirectional pattern synonym for 'snoc' (/O(n)/) and 'unsnoc' (/O(1)/)
-- to be used together with 'Empty'.
--
-- @since 2.1.2
-- @since 2.2
pattern (:>) :: Text -> Char -> Text
pattern xs :> x <- (unsnoc -> Just (xs, x)) where
(:>) = snoc
Expand Down Expand Up @@ -1041,6 +1041,8 @@ foldl1' f t = S.foldl1' f (stream t)
{-# INLINE foldl1' #-}

-- | /O(n)/ A monadic version of 'foldl''.
--
-- @since 2.2
foldlM' :: Monad m => (a -> Char -> m a) -> a -> Text -> m a
foldlM' f z t = S.foldlM' f z (stream t)
{-# INLINE foldlM' #-}
Expand Down Expand Up @@ -1581,7 +1583,7 @@ inits = (NonEmptyList.toList $!) . initsNE
-- | /O(n)/ Return all initial segments of the given 'Text', shortest
-- first.
--
-- @since 2.1.2
-- @since 2.2
initsNE :: Text -> NonEmptyList.NonEmpty Text
initsNE t = empty NonEmptyList.:| case t of
Text arr off len ->
Expand All @@ -1598,7 +1600,7 @@ tails = (NonEmptyList.toList $!) . tailsNE
-- | /O(n)/ Return all final segments of the given 'Text', longest
-- first.
--
-- @since 2.1.2
-- @since 2.2
tailsNE :: Text -> NonEmptyList.NonEmpty Text
tailsNE t
| null t = empty NonEmptyList.:| []
Expand Down Expand Up @@ -2096,6 +2098,8 @@ overflowError :: HasCallStack => String -> a
overflowError fun = P.error $ "Data.Text." ++ fun ++ ": size overflow"

-- | Convert a value to 'Text'.
--
-- @since 2.2
show :: Show a => a -> Text
show = pack . P.show

Expand Down
2 changes: 1 addition & 1 deletion src/Data/Text/Foreign.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ peekCStringLen cs = do
-- to have been encoded as UTF-8. If decoding fails, a
-- 'UnicodeException' is thrown.
--
-- @since 2.1.2
-- @since 2.2
peekCString :: CString -> IO Text
peekCString cs = do
bs <- unsafePackCString cs
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Text/Internal/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import qualified Data.Text as T

data Text = Empty
-- ^ Empty text.
--
-- @since 2.2
| Chunk {-# UNPACK #-} !T.Text Text
-- ^ Chunks must be non-empty, this invariant is not checked.
deriving (Typeable)
Expand Down
11 changes: 7 additions & 4 deletions src/Data/Text/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ null _ = False
-- | Bidirectional pattern synonym for 'cons' (/O(n)/) and 'uncons' (/O(1)/),
-- to be used together with 'Empty'.
--
-- @since 2.1.2
-- @since 2.2
pattern (:<) :: Char -> Text -> Text
pattern x :< xs <- (uncons -> Just (x, xs)) where
(:<) = cons
Expand All @@ -553,7 +553,7 @@ infixr 5 :<
-- | Bidirectional pattern synonym for 'snoc' (/O(n)/) and 'unsnoc' (/O(1)/)
-- to be used together with 'Empty'.
--
-- @since 2.1.2
-- @since 2.2
pattern (:>) :: Text -> Char -> Text
pattern xs :> x <- (unsnoc -> Just (xs, x)) where
(:>) = snoc
Expand Down Expand Up @@ -853,6 +853,7 @@ foldl1' f t = S.foldl1' f (stream t)

-- | /O(n)/ A monadic version of 'foldl''.
--
-- @since 2.2
foldlM' :: Monad m => (a -> Char -> m a) -> a -> Text -> m a
foldlM' f z t = S.foldlM' f z (stream t)
{-# INLINE foldlM' #-}
Expand Down Expand Up @@ -1476,7 +1477,7 @@ inits = (NE.toList P.$!) . initsNE
-- | /O(n²)/ Return all initial segments of the given 'Text',
-- shortest first.
--
-- @since 2.1.2
-- @since 2.2
initsNE :: Text -> NonEmpty Text
initsNE ts0 = Empty NE.:| inits' 0 ts0
where
Expand All @@ -1499,7 +1500,7 @@ tails = (NE.toList P.$!) . tailsNE
-- | /O(n)/ Return all final segments of the given 'Text', longest
-- first.
--
-- @since 2.1.2
-- @since 2.2
tailsNE :: Text -> NonEmpty Text
tailsNE Empty = Empty :| []
tailsNE ts@(Chunk t ts')
Expand Down Expand Up @@ -1828,6 +1829,8 @@ zipWith f t1 t2 = unstream (S.zipWith g (stream t1) (stream t2))
{-# INLINE [0] zipWith #-}

-- | Convert a value to lazy 'Text'.
--
-- @since 2.2
show :: Show a => a -> Text
show = pack . P.show

Expand Down

0 comments on commit 7524c19

Please sign in to comment.