text-all 0.1.0.0 → 0.2.0.0
raw patch · 4 files changed
+118/−34 lines, 4 filesdep ~textdep ~text-formatdep ~text-showPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: text, text-format, text-show
API changes (from Hackage documentation)
- Data.Text.All: fromStrict :: Text -> Text
- Data.Text.All: toStrict :: Text -> Text
- Data.Text.Lazy.All: show :: TextShow a => a -> Text
- Data.Text.Lazy.All: show' :: Show a => a -> Text
+ Data.Text.All: bformat :: Params ps => Format -> ps -> Builder
+ Data.Text.All: bshow :: TextShow a => a -> Builder
+ Data.Text.All: bshow' :: Show a => a -> Builder
+ Data.Text.All: bsingleton :: Char -> Builder
+ Data.Text.All: builderToLazy :: Builder -> LText
+ Data.Text.All: builderToStrict :: Builder -> Text
+ Data.Text.All: data Builder :: *
+ Data.Text.All: flush :: Builder
+ Data.Text.All: lazyToBuilder :: LText -> Builder
+ Data.Text.All: lazyToStrict :: LText -> Text
+ Data.Text.All: lformat :: Params ps => Format -> ps -> LText
+ Data.Text.All: lshow :: TextShow a => a -> LText
+ Data.Text.All: lshow' :: Show a => a -> LText
+ Data.Text.All: strictToBuilder :: Text -> Builder
+ Data.Text.All: strictToLazy :: Text -> LText
+ Data.Text.All: type LText = Text
Files
- CHANGELOG.md +12/−0
- lib/Data/Text/All.hs +100/−10
- lib/Data/Text/Lazy/All.hs +1/−19
- text-all.cabal +5/−5
CHANGELOG.md view
@@ -1,3 +1,15 @@+# 0.2.0.0++* Renamed lots of functions, moved some into other modules.++* Added `Builder`-related functions.++* Reexported `Buildable`.++* Added the `LText` type synonym.++* Made the upper bounds strict.+ # 0.1.0.0 First release.
lib/Data/Text/All.hs view
@@ -1,13 +1,33 @@ module Data.Text.All (+ -- * Standard modules from text module Data.Text, module Data.Text.IO, module Data.Text.Encoding,++ -- * Types+ LText,+ Builder,++ -- * Showing+ show, lshow, bshow,+ -- ** Via 'Show'+ show', lshow', bshow',++ -- * Conversion+ strictToLazy, lazyToStrict,++ -- * Formatting module Data.Text.Format, module Data.Text.Buildable,- show, show',- format,- toStrict, fromStrict,+ format, lformat, bformat,++ -- * Builder+ bsingleton,+ flush,+ -- ** Conversion+ builderToStrict, builderToLazy,+ strictToBuilder, lazyToBuilder, ) where @@ -15,26 +35,96 @@ import Data.Text import Data.Text.IO import Data.Text.Encoding-import Data.Text.Lazy (toStrict, fromStrict)+import qualified Data.Text.Lazy.Builder as B+import Data.Text.Lazy.Builder (Builder) -import TextShow+import qualified Data.Text.Lazy as TL -import Data.Text.Format hiding (format, print, hprint)+import TextShow hiding (Builder)++import Data.Text.Format hiding (format, print, hprint, build) import Data.Text.Format.Params-import Data.Text.Buildable (Buildable)+import Data.Text.Buildable import qualified Data.Text.Format as Format import qualified Prelude as P import Prelude hiding (show) +-- | Lazy 'TL.Text'.+type LText = TL.Text+ -- | A fast variant of 'show' for 'Text' that only works for some types. If you want more instances, import <https://hackage.haskell.org/package/text-show-instances text-show-instances> or use 'show'' if the type is your own and you only have a 'Show' instance defined. show :: TextShow a => a -> Text show = showt+{-# INLINE show #-} --- | Like 'show', but works for anything that has a 'Show' instance.+lshow :: TextShow a => a -> LText+lshow = showtl+{-# INLINE lshow #-}++bshow :: TextShow a => a -> Builder+bshow = showb+{-# INLINE bshow #-}++-- | Like 'show', but works for anything that has a 'Show' instance. Slower than 'show'. show' :: Show a => a -> Text show' = pack . P.show+{-# INLINE show' #-} --- | A formatting function that mimics 'Data.Text.Format.format', but works on strict 'Text'.+lshow' :: Show a => a -> LText+lshow' = TL.pack . P.show+{-# INLINE lshow' #-}++bshow' :: Show a => a -> Builder+bshow' = B.fromString . P.show+{-# INLINE bshow' #-}++-- | A variant of 'Data.Text.Format.format' that produces strict 'Text'. format :: Params ps => Format -> ps -> Text-format f = toStrict . Format.format f+format f = TL.toStrict . Format.format f+{-# INLINE format #-}++-- | A variant of 'Data.Text.Format.format' that produces lazy 'Text'.+lformat :: Params ps => Format -> ps -> LText+lformat = Format.format+{-# INLINE lformat #-}++-- | A variant of 'Data.Text.Format.format' that produces a 'Builder'.+bformat :: Params ps => Format -> ps -> Builder+bformat = Format.build+{-# INLINE bformat #-}++-- | Convert a 'Text' into a lazy 'TL.Text'.+strictToLazy :: Text -> LText+strictToLazy = TL.fromStrict+{-# INLINE strictToLazy #-}++-- | Convert a lazy 'TL.Text' into a 'Text'.+lazyToStrict :: LText -> Text+lazyToStrict = TL.toStrict+{-# INLINE lazyToStrict #-}++-- | Convert a 'Builder' into a 'Text'.+builderToStrict :: Builder -> Text+builderToStrict = TL.toStrict . B.toLazyText+{-# INLINE builderToStrict #-}++-- | Convert a 'Builder' into a lazy 'TL.Text'.+builderToLazy :: Builder -> LText+builderToLazy = B.toLazyText+{-# INLINE builderToLazy #-}++-- | Convert a 'Text' into a 'Builder'.+strictToBuilder :: Text -> Builder+strictToBuilder = B.fromText+{-# INLINE strictToBuilder #-}++-- | Convert a lazy 'TL.Text' into a 'Builder'.+lazyToBuilder :: LText -> Builder+lazyToBuilder = B.fromLazyText+{-# INLINE lazyToBuilder #-}++-- | A 'Builder' producing a single character.+bsingleton :: Char -> Builder+bsingleton = B.singleton+{-# INLINE bsingleton #-}
lib/Data/Text/Lazy/All.hs view
@@ -1,11 +1,9 @@ module Data.Text.Lazy.All (+ -- * Standard modules from text module Data.Text.Lazy, module Data.Text.Lazy.IO, module Data.Text.Lazy.Encoding,- module Data.Text.Format,- module Data.Text.Buildable,- show, show', ) where @@ -13,19 +11,3 @@ import Data.Text.Lazy import Data.Text.Lazy.IO import Data.Text.Lazy.Encoding--import TextShow--import Data.Text.Format hiding (print, hprint)-import Data.Text.Buildable (Buildable)-import qualified Prelude as P-import Prelude hiding (show)----- | A fast variant of 'show' for 'Text' that only works for some types. If you want more instances, import <https://hackage.haskell.org/package/text-show-instances text-show-instances> or use 'show'' if the type is your own and you only have a 'Show' instance defined.-show :: TextShow a => a -> Text-show = showtl---- | Like 'show', but works for anything that has a 'Show' instance.-show' :: Show a => a -> Text-show' = pack . P.show
text-all.cabal view
@@ -1,10 +1,10 @@ name: text-all-version: 0.1.0.0+version: 0.2.0.0 synopsis: Everything Data.Text related in one package description: Everything @Data.Text@-related in one package. .- Note that this package does not follow PVP – it specifies lower bounds for its dependencies, but the upper bounds are somewhat lax. This shouldn't be a problem, however, since @Data.Text.All@ is intended to be imported qualified.+ Note: this package does follow PVP. homepage: http://github.com/aelve/text-all bug-reports: http://github.com/aelve/text-all/issues license: BSD3@@ -28,9 +28,9 @@ -- other-modules: -- other-extensions: build-depends: base >=4.5 && <5- , text >=1.2.2 && <2- , text-show >=3.2 && <4- , text-format >=0.3.1 && <0.4+ , text ==1.2.2.*+ , text-show ==3.2.*+ , text-format ==0.3.1.* ghc-options: -Wall -fno-warn-unused-do-bind hs-source-dirs: lib default-language: Haskell2010