@hackage text-show1
Efficient conversion of values into Text
Categories
License
BSD-3-Clause
Maintainer
Ryan Scott <ryan.gl.scott@gmail.com>
Links
Versions
Installation
Dependencies (16)
- array >=0.3 && <0.6
- base >=4.3 && <5
- base-compat >=0.8.1 && <1
- bytestring >=0.9 && <0.11
- bytestring-builder
- containers >=0.1 && <0.6 Show all…
Dependents (70)
@hackage/dojang, @hackage/minecraft-data, @hackage/fb-util, @hackage/blosum, @hackage/dwarf-el, @hackage/consumers, Show all…
text-show

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:
module Main where
import Data.Text (Text)
import Prelude hiding (Show(..), print)
import Text.Show.Text
hello :: Text
hello = show (Just "Hello, World!")
main :: IO ()
main = print hello
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).
Support for automatically deriving Show instances can be found in the Text.Show.Text.TH and Text.Show.Text.Generic modules. If you don't know which one to use, use Text.Show.Text.TH.