Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
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