text-format-0.3.2.1: Text formatting
Copyright(c) 2011 MailRank Inc.
LicenseBSD-style
Maintainerbos@serpentine.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Text.Format.Types

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.

Instances

Instances details
IsString Format Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

fromString :: String -> Format #

Monoid Format Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Semigroup Format Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Show Format Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Eq Format Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(==) :: Format -> Format -> Bool #

(/=) :: Format -> Format -> Bool #

Ord Format Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

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

Instances

Instances details
Bounded a => Bounded (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

minBound :: Only a #

maxBound :: Only a #

Enum a => Enum (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

succ :: Only a -> Only a #

pred :: Only a -> Only a #

toEnum :: Int -> Only a #

fromEnum :: Only a -> Int #

enumFrom :: Only a -> [Only a] #

enumFromThen :: Only a -> Only a -> [Only a] #

enumFromTo :: Only a -> Only a -> [Only a] #

enumFromThenTo :: Only a -> Only a -> Only a -> [Only a] #

Floating a => Floating (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

pi :: Only a #

exp :: Only a -> Only a #

log :: Only a -> Only a #

sqrt :: Only a -> Only a #

(**) :: Only a -> Only a -> Only a #

logBase :: Only a -> Only a -> Only a #

sin :: Only a -> Only a #

cos :: Only a -> Only a #

tan :: Only a -> Only a #

asin :: Only a -> Only a #

acos :: Only a -> Only a #

atan :: Only a -> Only a #

sinh :: Only a -> Only a #

cosh :: Only a -> Only a #

tanh :: Only a -> Only a #

asinh :: Only a -> Only a #

acosh :: Only a -> Only a #

atanh :: Only a -> Only a #

log1p :: Only a -> Only a #

expm1 :: Only a -> Only a #

log1pexp :: Only a -> Only a #

log1mexp :: Only a -> Only a #

RealFloat a => RealFloat (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Num a => Num (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(+) :: Only a -> Only a -> Only a #

(-) :: Only a -> Only a -> Only a #

(*) :: Only a -> Only a -> Only a #

negate :: Only a -> Only a #

abs :: Only a -> Only a #

signum :: Only a -> Only a #

fromInteger :: Integer -> Only a #

Read a => Read (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Fractional a => Fractional (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(/) :: Only a -> Only a -> Only a #

recip :: Only a -> Only a #

fromRational :: Rational -> Only a #

Integral a => Integral (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

quot :: Only a -> Only a -> Only a #

rem :: Only a -> Only a -> Only a #

div :: Only a -> Only a -> Only a #

mod :: Only a -> Only a -> Only a #

quotRem :: Only a -> Only a -> (Only a, Only a) #

divMod :: Only a -> Only a -> (Only a, Only a) #

toInteger :: Only a -> Integer #

Real a => Real (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

toRational :: Only a -> Rational #

RealFrac a => RealFrac (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

properFraction :: Integral b => Only a -> (b, Only a) #

truncate :: Integral b => Only a -> b #

round :: Integral b => Only a -> b #

ceiling :: Integral b => Only a -> b #

floor :: Integral b => Only a -> b #

Show a => Show (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

showsPrec :: Int -> Only a -> ShowS #

show :: Only a -> String #

showList :: [Only a] -> ShowS #

Eq a => Eq (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(==) :: Only a -> Only a -> Bool #

(/=) :: Only a -> Only a -> Bool #

Ord a => Ord (Only a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

compare :: Only a -> Only a -> Ordering #

(<) :: Only a -> Only a -> Bool #

(<=) :: Only a -> Only a -> Bool #

(>) :: Only a -> Only a -> Bool #

(>=) :: Only a -> Only a -> Bool #

max :: Only a -> Only a -> Only a #

min :: Only a -> Only a -> Only a #

Buildable a => Params (Only a) Source # 
Instance details

Defined in Data.Text.Format.Params

Methods

buildParams :: Only a -> [Builder] Source #

newtype Shown a Source #

Render a value using its Show instance.

Constructors

Shown 

Fields

Instances

Instances details
Bounded a => Bounded (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

minBound :: Shown a #

maxBound :: Shown a #

Enum a => Enum (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

succ :: Shown a -> Shown a #

pred :: Shown a -> Shown a #

toEnum :: Int -> Shown a #

fromEnum :: Shown a -> Int #

enumFrom :: Shown a -> [Shown a] #

enumFromThen :: Shown a -> Shown a -> [Shown a] #

enumFromTo :: Shown a -> Shown a -> [Shown a] #

enumFromThenTo :: Shown a -> Shown a -> Shown a -> [Shown a] #

Floating a => Floating (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

pi :: Shown a #

exp :: Shown a -> Shown a #

log :: Shown a -> Shown a #

sqrt :: Shown a -> Shown a #

(**) :: Shown a -> Shown a -> Shown a #

logBase :: Shown a -> Shown a -> Shown a #

sin :: Shown a -> Shown a #

cos :: Shown a -> Shown a #

tan :: Shown a -> Shown a #

asin :: Shown a -> Shown a #

acos :: Shown a -> Shown a #

atan :: Shown a -> Shown a #

sinh :: Shown a -> Shown a #

cosh :: Shown a -> Shown a #

tanh :: Shown a -> Shown a #

asinh :: Shown a -> Shown a #

acosh :: Shown a -> Shown a #

atanh :: Shown a -> Shown a #

log1p :: Shown a -> Shown a #

expm1 :: Shown a -> Shown a #

log1pexp :: Shown a -> Shown a #

log1mexp :: Shown a -> Shown a #

RealFloat a => RealFloat (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Num a => Num (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(+) :: Shown a -> Shown a -> Shown a #

(-) :: Shown a -> Shown a -> Shown a #

(*) :: Shown a -> Shown a -> Shown a #

negate :: Shown a -> Shown a #

abs :: Shown a -> Shown a #

signum :: Shown a -> Shown a #

fromInteger :: Integer -> Shown a #

Read a => Read (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Fractional a => Fractional (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(/) :: Shown a -> Shown a -> Shown a #

recip :: Shown a -> Shown a #

fromRational :: Rational -> Shown a #

Integral a => Integral (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

quot :: Shown a -> Shown a -> Shown a #

rem :: Shown a -> Shown a -> Shown a #

div :: Shown a -> Shown a -> Shown a #

mod :: Shown a -> Shown a -> Shown a #

quotRem :: Shown a -> Shown a -> (Shown a, Shown a) #

divMod :: Shown a -> Shown a -> (Shown a, Shown a) #

toInteger :: Shown a -> Integer #

Real a => Real (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

toRational :: Shown a -> Rational #

RealFrac a => RealFrac (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

properFraction :: Integral b => Shown a -> (b, Shown a) #

truncate :: Integral b => Shown a -> b #

round :: Integral b => Shown a -> b #

ceiling :: Integral b => Shown a -> b #

floor :: Integral b => Shown a -> b #

Show a => Show (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

showsPrec :: Int -> Shown a -> ShowS #

show :: Shown a -> String #

showList :: [Shown a] -> ShowS #

Eq a => Eq (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(==) :: Shown a -> Shown a -> Bool #

(/=) :: Shown a -> Shown a -> Bool #

Ord a => Ord (Shown a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

compare :: Shown a -> Shown a -> Ordering #

(<) :: Shown a -> Shown a -> Bool #

(<=) :: Shown a -> Shown a -> Bool #

(>) :: Shown a -> Shown a -> Bool #

(>=) :: Shown a -> Shown a -> Bool #

max :: Shown a -> Shown a -> Shown a #

min :: Shown a -> Shown a -> Shown a #

Show a => Buildable (Shown a) Source # 
Instance details

Defined in Data.Text.Buildable

Methods

build :: Shown a -> Builder Source #

Integer format control

newtype Hex a Source #

Render an integral type in hexadecimal.

Constructors

Hex a 

Instances

Instances details
Enum a => Enum (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

succ :: Hex a -> Hex a #

pred :: Hex a -> Hex a #

toEnum :: Int -> Hex a #

fromEnum :: Hex a -> Int #

enumFrom :: Hex a -> [Hex a] #

enumFromThen :: Hex a -> Hex a -> [Hex a] #

enumFromTo :: Hex a -> Hex a -> [Hex a] #

enumFromThenTo :: Hex a -> Hex a -> Hex a -> [Hex a] #

Num a => Num (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(+) :: Hex a -> Hex a -> Hex a #

(-) :: Hex a -> Hex a -> Hex a #

(*) :: Hex a -> Hex a -> Hex a #

negate :: Hex a -> Hex a #

abs :: Hex a -> Hex a #

signum :: Hex a -> Hex a #

fromInteger :: Integer -> Hex a #

Read a => Read (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Integral a => Integral (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

quot :: Hex a -> Hex a -> Hex a #

rem :: Hex a -> Hex a -> Hex a #

div :: Hex a -> Hex a -> Hex a #

mod :: Hex a -> Hex a -> Hex a #

quotRem :: Hex a -> Hex a -> (Hex a, Hex a) #

divMod :: Hex a -> Hex a -> (Hex a, Hex a) #

toInteger :: Hex a -> Integer #

Real a => Real (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

toRational :: Hex a -> Rational #

Show a => Show (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

showsPrec :: Int -> Hex a -> ShowS #

show :: Hex a -> String #

showList :: [Hex a] -> ShowS #

Eq a => Eq (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

(==) :: Hex a -> Hex a -> Bool #

(/=) :: Hex a -> Hex a -> Bool #

Ord a => Ord (Hex a) Source # 
Instance details

Defined in Data.Text.Format.Types.Internal

Methods

compare :: Hex a -> Hex a -> Ordering #

(<) :: Hex a -> Hex a -> Bool #

(<=) :: Hex a -> Hex a -> Bool #

(>) :: Hex a -> Hex a -> Bool #

(>=) :: Hex a -> Hex a -> Bool #

max :: Hex a -> Hex a -> Hex a #

min :: Hex a -> Hex a -> Hex a #

Integral a => Buildable (Hex a) Source # 
Instance details

Defined in Data.Text.Buildable

Methods

build :: Hex a -> Builder Source #