vformat-0.14.1.0: A Python str.format() like formatter

Safe HaskellSafe
LanguageHaskell2010

Text.Format.TH

Contents

Synopsis

Documentation

formatQQ :: QuasiQuoter Source #

A QuasiQuoter for Format with which you can write multi-line Format.

Note: ">>>" after "[formatQQ|" means starting from the next line, "<<<" before "|]" means ending from the previous line.

Example

>>> :set -XTemplateHaskell
>>> :set -XQuasiQuotes
>>> import     Text.Format
>>> import     Text.Format.TH
>>> :{
fmt1 :: Format
fmt1 = [formatQQ|>>>
first line {hi}
newline {words}
last line {bye}
<<<|]
fmt2 :: Format
fmt2 = [formatQQ|first line {hi}
newline {words}
last line {bye}|]
fmt3 :: Format
fmt3 = "first line {hi}\nnewline {words}\nlast line {bye}"
:}
>>> format fmt1 ("hi" := "hi") ("words"  := "say something") ("bye" := "bye")
"first line hi\nnewline say something\nlast line bye"
>>> format fmt2 ("hi" := "hi") ("words"  := "say something") ("bye" := "bye")
"first line hi\nnewline say something\nlast line bye"
>>> format fmt3 ("hi" := "hi") ("words"  := "say something") ("bye" := "bye")
"first line hi\nnewline say something\nlast line bye"

Since: 0.14.0

format1QQ :: QuasiQuoter Source #

Same as formatQQ, but for Format1.

Since: 0.14.0

Orphan instances

Lift ArgKey Source # 
Instance details

Methods

lift :: ArgKey -> Q Exp #

Lift ArgFmt Source # 
Instance details

Methods

lift :: ArgFmt -> Q Exp #

Lift FmtNumSep Source # 
Instance details

Methods

lift :: FmtNumSep -> Q Exp #

Lift FmtSign Source # 
Instance details

Methods

lift :: FmtSign -> Q Exp #

Lift FmtAlign Source # 
Instance details

Methods

lift :: FmtAlign -> Q Exp #

Lift Format1 Source # 
Instance details

Methods

lift :: Format1 -> Q Exp #

Lift Format Source # 
Instance details

Methods

lift :: Format -> Q Exp #