text-format-0.3.1.0: Text formatting

PortabilityGHC
Stabilityexperimental
Maintainerbos@serpentine.com
Safe HaskellNone

Data.Text.Format.Types

Contents

Description

Types for text mangling.

Synopsis

Documentation

data Format Source

A format string. This is intentionally incompatible with other string types, to make it difficult to construct a format string by concatenating string fragments (a very common way to accidentally make code vulnerable to malicious data).

This type is an instance of IsString, so the easiest way to construct a query is to enable the OverloadedStrings language extension and then simply write the query in double quotes.

 {-# LANGUAGE OverloadedStrings #-}

 import Data.Text.Format

 f :: Format
 f = "hello {}"

The underlying type is Text, so literal Haskell strings that contain Unicode characters will be correctly handled.

newtype Only a Source

Use this newtype wrapper for your single parameter if you are formatting a string containing exactly one substitution site.

Constructors

Only 

Fields

fromOnly :: a
 

Instances

Bounded a => Bounded (Only a) 
Enum a => Enum (Only a) 
Eq a => Eq (Only a) 
(Fractional (Only a), Floating a) => Floating (Only a) 
(Num (Only a), Fractional a) => Fractional (Only a) 
(Real (Only a), Enum (Only a), Integral a) => Integral (Only a) 
Num a => Num (Only a) 
(Eq (Only a), Ord a) => Ord (Only a) 
Read a => Read (Only a) 
(Num (Only a), Ord (Only a), Real a) => Real (Only a) 
(RealFrac (Only a), Floating (Only a), RealFloat a) => RealFloat (Only a) 
(Real (Only a), Fractional (Only a), RealFrac a) => RealFrac (Only a) 
Show a => Show (Only a) 
Buildable a => Params (Only a) 

newtype Shown a Source

Render a value using its Show instance.

Constructors

Shown 

Fields

shown :: a
 

Instances

Bounded a => Bounded (Shown a) 
Enum a => Enum (Shown a) 
Eq a => Eq (Shown a) 
(Fractional (Shown a), Floating a) => Floating (Shown a) 
(Num (Shown a), Fractional a) => Fractional (Shown a) 
(Real (Shown a), Enum (Shown a), Integral a) => Integral (Shown a) 
Num a => Num (Shown a) 
(Eq (Shown a), Ord a) => Ord (Shown a) 
Read a => Read (Shown a) 
(Num (Shown a), Ord (Shown a), Real a) => Real (Shown a) 
(RealFrac (Shown a), Floating (Shown a), RealFloat a) => RealFloat (Shown a) 
(Real (Shown a), Fractional (Shown a), RealFrac a) => RealFrac (Shown a) 
Show a => Show (Shown a) 
Show a => Buildable (Shown a) 

Integer format control

newtype Hex a Source

Render an integral type in hexadecimal.

Constructors

Hex a 

Instances

Enum a => Enum (Hex a) 
Eq a => Eq (Hex a) 
(Real (Hex a), Enum (Hex a), Integral a) => Integral (Hex a) 
Num a => Num (Hex a) 
(Eq (Hex a), Ord a) => Ord (Hex a) 
Read a => Read (Hex a) 
(Num (Hex a), Ord (Hex a), Real a) => Real (Hex a) 
Show a => Show (Hex a) 
Integral a => Buildable (Hex a)