text-show: Efficient conversion of values into Text

[ bsd3, library, text ] [ Propose Tags ]

text-show offers a replacement for the Show typeclass intended for use with Text instead of Strings. This package was created in the spirit of bytestring-show.

At the moment, text-show provides Show instances for most data types in the array, base, bytestring, and text packages. Therefore, much of the source code for text-show consists of borrowed code from those packages in order to ensure that the behaviors of the two Show typeclasses coincide.

For most uses, simply importing Text.Show.Text will suffice:

{-# LANGUAGE NoImplicitPrelude #-}
module Main where

import Data.Text (Text)
import Prelude hiding (Show(..), print)
import Text.Show.Text

number :: Text
number = show (Just "Hello, World!")

main :: IO ()
main = print number

If you desire it, there are also monomorphic versions of the showb function available in the submodules of Text.Show.Text. A naming convention is present in which functions that show different values depending on the precedence end with Prec (e.g., showbIntPrec), whereas functions that show the same values regardless of precedence do not end with Prec (e.g., showbBool).


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.4, 0.4.1, 0.5, 0.6, 0.6.0.1, 0.7, 0.7.0.1, 0.8, 0.8.1, 0.8.1.1, 1, 2, 2.1, 2.1.1, 2.1.2, 3, 3.0.1, 3.1, 3.2, 3.2.1, 3.2.2, 3.3, 3.4, 3.4.1, 3.4.1.1, 3.6, 3.6.2, 3.7, 3.7.1, 3.7.2, 3.7.3, 3.7.4, 3.7.5, 3.8, 3.8.1, 3.8.2
Change log CHANGELOG.md
Dependencies array (>=0.3 && <0.6), base (>=4.2 && <4.8), bytestring (>=0.9 && <0.11), ghc-prim, integer-gmp (>=0.2), nats (>=0.1 && <2), tagged (>=0.4.4 && <1), template-haskell (>=2.4 && <2.11), text (>=0.2 && <1.3), transformers (>=0.2.1 && <0.5), transformers-compat (>=0.3 && <1), void (>=0.5 && <1) [details]
License BSD-3-Clause
Copyright (C) 2014-2015 Ryan Scott
Author Ryan Scott
Maintainer Ryan Scott <ryan.gl.scott@gmail.com>
Revised Revision 2 made by HerbertValerioRiedel at Fri Feb 5 14:36:03 UTC 2016
Category Text
Home page https://github.com/RyanGlScott/text-show
Bug tracker https://github.com/RyanGlScott/text-show/issues
Source repo head: git clone git://github.com/RyanGlScott/text-show.git
Uploaded by ryanglscott at Fri Jan 2 02:45:14 UTC 2015
Distributions Debian:3.7.4, LTSHaskell:3.7.5, NixOS:3.8.2, Stackage:3.8.2
Downloads 24493 total (915 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2015-01-02 [all 1 reports]

Modules

[Index]

Flags

NameDescriptionDefaultType
integer-gmp2

Use integer-gmp2.

EnabledAutomatic
recent-text

Use a recent version of text that fixes a bug related to converting large Integers to a Builder.

EnabledAutomatic
transformers-four

Use a recent version of transformers.

EnabledAutomatic

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for text-show-0.5

[back to package description]

text-show Hackage version Build Status

text-show offers a replacement for the Show typeclass intended for use with Text instead of Strings. This package was created in the spirit of bytestring-show.

At the moment, text-show provides Show instances for most data types in the array, base, bytestring, and text packages. Therefore, much of the source code for text-show consists of borrowed code from those packages in order to ensure that the behaviors of the two Show typeclasses coincide.

For most uses, simply importing Text.Show.Text will suffice:

{-# LANGUAGE NoImplicitPrelude #-}
module Main where

import Data.Text (Text)
import Prelude hiding (Show(..), print)
import Text.Show.Text

number :: Text
number = show (Just "Hello, World!")

main :: IO ()
main = print number

If you desire it, there are also monomorphic versions of the showb function available in the submodules of Text.Show.Text. A naming convention is present in which functions that show different values depending on the precedence end with Prec(e.g., showbIntPrec), whereas functions that show the same values regardless of precedence do not end with Prec (e.g., showbBool).