talira

text-show

A Show replacement for Haskell that produces Text instead of String

open sourcetext-show BSD 3-clause licencefree

text-show offers a replacement for Haskell's Show typeclass that renders values as Text instead of String, with printT and friends, and derives TextShow instances through Template Haskell or GHC.Generics. It covers types from base, array, bytestring and text; text-show-instances covers other libraries.

Problems it solves

  • turn Haskell values into Text without going through String
  • derive a show-like instance that outputs Text for my Haskell data types
  • print values as Text in a Haskell program that uses Data.Text everywhere

Features

  • TextShow typeclass: render values as Text instead of String
  • derive instances with Template Haskell (TextShow.TH) or GHC.Generics (TextShow.Generic)
  • instances for types in base, array, bytestring and text

Limitations

  • Only covers types from base, array, bytestring and text; other libraries' types need text-show-instances.1

Alternatives

The same job

These do what text-show does.

  1. prettyprinter Wadler/Leijen pretty-printer for Haskell, Text-based, with annotations and pluggable backends

Compare text-show with the top 3