HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletext-printer-0.5.0.2Haskell2010

Text.Printer

Monoids with a homomorphism from String to themselves.

  • 5 types
  • 2 classes
  • 28 values

The class

1 declaration
classclass (IsString p, Semigroup p, Monoid p) => Printer p where
#

Text monoid. string must be equivalent to fromString and be a monoid homomorphism, i.e. string mempty = mempty and mappend (string x) (string y) = string (mappend x y). Other operations must be monoid homomorphisms that are eqiuvalent (but possibly faster) to the composition of string and the corresponding embedding, e.g. text = string . unpack.

Methods

Instances7Printer, …

Builders

12 declarations
newtypenewtype StringBuilder
#

A simple string builder as used by Show.

Instances6IsString, Generic, Semigroup, Monoid, Printer, Rep
newtypenewtype AsciiBuilder
#

Use this builder when you are sure that only ASCII characters will get printed to it.

Instances6IsString, Generic, Semigroup, Monoid, Printer, Rep
newtypenewtype Utf8Builder
#

UTF-8 lazy ByteString builder.

Instances6IsString, Generic, Semigroup, Monoid, Printer, Rep
newtypenewtype PrettyPrinter
#
Instances7IsString, Generic, Semigroup, Monoid, MultilinePrinter, Printer, …

Combinators

16 declarations
method(<>) :: a -> a -> a
#

An associative operation.

Examples
Example1 expression
[1,2,3] <> [4,5,6][1,2,3,4,5,6]
Example1 expression
Just [1, 2, 3] <> Just [4, 5, 6]Just [1,2,3,4,5,6]
Example1 expression
putStr "Hello, " <> putStrLn "World!"Hello, World!
valuefcat :: (Foldable f, Printer p) => (p -> p -> p) -> f p -> p
#

Combine the items of a Foldable data structure using the provided function. If the data structure is empty, mempty is returned.

valueseparate
  1. :: Printer p
  2. => p

    The separator

  3. -> p
  4. -> p
  5. -> p
#

Concatenate two Printers with a separator between them.

value(<+>) :: Printer p => p -> p -> p
#

Concatenate two Printers with a space between them.

Multiline printers

7 declarations
valuecrlf :: Printer p => p
#

Print CR ('r') followed by LF ('n').

newtypenewtype LinePrinter p
#

A multiline printer that combines lines with the provided function.

Constructors

Instances7IsString, Generic, Semigroup, Monoid, MultilinePrinter, Printer, …