text-all 0.3.1.0 → 0.4.0.0
raw patch · 4 files changed
+47/−47 lines, 4 filesdep −text-show
Dependencies removed: text-show
Files
- CHANGELOG.md +13/−4
- lib/Data/Text/All.hs +21/−41
- lib/Data/Text/Lazy/All.hs +12/−0
- text-all.cabal +1/−2
CHANGELOG.md view
@@ -1,18 +1,27 @@+# 0.4.0.0++* Dropped `text-show` entirely; now `show` works via `Prelude.show`, which is+ slower but avoids a heavy dependency. It is recommended to use+ `text-format`, `formatting` or `fmt` if fast formatting is needed.+ +* Added `show` and `format` to `Data.Text.Lazy.All`.+ # 0.3.1.0 -* Bumped the text-show upper bound. (text-show added some instances.)+* Bumped the `text-show` upper bound. (`text-show` added some instances.) # 0.3.0.2 -* Bumped the text-show upper bound.+* Bumped the `text-show` upper bound. # 0.3.0.1 -* Bumped the text-show upper bound.+* Bumped the `text-show` upper bound. # 0.3.0.0 -* Replaced functions like `strictToBuilder` with conversion typeclasses (i.e. now it's just `toStrict`, `toLazy`, `toBuilder`, and `toString`).+* Replaced functions like `strictToBuilder` with conversion typeclasses (i.e.+ now it's just `toStrict`, `toLazy`, `toBuilder`, and `toString`). # 0.2.0.0
lib/Data/Text/All.hs view
@@ -1,16 +1,15 @@-{-# LANGUAGE-GADTs,-TypeSynonymInstances- #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE TypeSynonymInstances #-} -{- |-Here are the nice things from text that you get (thanks to a restrictive lower bound) but that aren't documented elsewhere in this module:+{- | Note that thanks to a restrictive lower bound on @text@, you can be sure+that the following things will be present in the "Data.Text" reexport: * The 'T.takeWhileEnd' function.-* An instance for @Semigroup@.-* An instance for @printf@ (i.e. you can use a 'Text' as one of @printf@'s arguments).-* An instance for @Binary@.+* An instance for @Semigroup Text@.+* An instance for @Binary Text@.+* An instance for 'Text.Printf.printf' (i.e. you can use a 'Text' as one of+ @printf@'s arguments). -} module Data.Text.All (@@ -28,13 +27,7 @@ -- * Showing -- $showing-- -- ** Strict 'Text'- show, show',- -- ** Lazy 'Text'- lshow, lshow',- -- ** 'Builder'- bshow, bshow',+ show, lshow, bshow, -- * Formatting -- $formatting@@ -54,12 +47,10 @@ import Data.Text.IO import Data.Text.Encoding import qualified Data.Text.Lazy.Builder as B-import Data.Text.Lazy.Builder (Builder)+import Data.Text.Lazy.Builder (Builder, flush) import qualified Data.Text.Lazy as TL -import TextShow hiding (Builder, toString)- import Data.Text.Format hiding (format, print, hprint, build) import Data.Text.Format.Params import Data.Text.Buildable@@ -72,38 +63,27 @@ {- $showing -'show' is a fast variant of @show@ for 'Text' \/ 'Builder' that only works for some types – it's very fast for 'Int', etc, but doesn't work for types that you have defined yourself. (If you want more instances, import <https://hackage.haskell.org/package/text-show-instances text-show-instances>.)--'show'' is a shortcut for @pack.show@ that works for everything with a 'Show' instance but is slower.+Variants below use 'P.show' from "Prelude". If you want faster showing,+either use <https://hackage.haskell.org/package/text-show text-show> or some+formatting library. -} -show :: TextShow a => a -> Text-show = showt+show :: Show a => a -> Text+show = pack . P.show {-# INLINE show #-} -lshow :: TextShow a => a -> LText-lshow = showtl+lshow :: Show a => a -> LText+lshow = TL.pack . P.show {-# INLINE lshow #-} -bshow :: TextShow a => a -> Builder-bshow = showb+bshow :: Show a => a -> Builder+bshow = B.fromString . P.show {-# INLINE bshow #-} -show' :: Show a => a -> Text-show' = pack . P.show-{-# INLINE show' #-}--lshow' :: Show a => a -> LText-lshow' = TL.pack . P.show-{-# INLINE lshow' #-}--bshow' :: Show a => a -> Builder-bshow' = B.fromString . P.show-{-# INLINE bshow' #-}- {- $formatting -'format' is a function similar to @printf@ in spirit. Don't forget to enable @OverloadedStrings@ if you want to use it!+'format' is a function similar to @printf@ in spirit. Don't forget to enable+@OverloadedStrings@ if you want to use it! >>> format "{}+{}={}" (2, 2, 4) "2+2=4"
lib/Data/Text/Lazy/All.hs view
@@ -4,6 +4,9 @@ module Data.Text.Lazy, module Data.Text.Lazy.IO, module Data.Text.Lazy.Encoding,++ -- * Lazy text functions+ show, format, ) where @@ -11,3 +14,12 @@ import Data.Text.Lazy import Data.Text.Lazy.IO import Data.Text.Lazy.Encoding+import Data.Text.Format (format)+import qualified Prelude as P+import Prelude hiding (show)+++-- | A synonym for 'Data.Text.All.lshow'.+show :: Show a => a -> Text+show = pack . P.show+{-# INLINE show #-}
text-all.cabal view
@@ -1,5 +1,5 @@ name: text-all-version: 0.3.1.0+version: 0.4.0.0 synopsis: Everything Data.Text related in one package description: Everything @Data.Text@-related in one package.@@ -29,7 +29,6 @@ -- other-extensions: build-depends: base >=4.5 && <5 , text ==1.2.2.*- , text-show >=3.2 && <3.7 , text-format ==0.3.1.* ghc-options: -Wall -fno-warn-unused-do-bind hs-source-dirs: lib