Copyright | (c) Moritz Clasmeier 2017-2018 |
---|---|
License | BSD3 |
Maintainer | mtesseract@silverratio.net |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
fmt :: QuasiQuoter Source #
Quasi Quoter for format strings. Examples:
Examples:
>>>
let answer = 42 in [fmt|What is the answer to universe, life and everything? It's $answer!|]
"What is the answer to universe, life and everything? It's 42!"
>>>
let toggle = True in [fmt|The toggle is switched ${if toggle then ("on" :: Text) else "off"}|]
"The toggle is switched on"
>>>
let timeDelta = 60 in [fmt|Request latency: ${timeDelta}ms|]
"Request latency: 60ms"
fmtConcat :: [Text] -> Text Source #
This is just specialized mconcat
, reexported under a
specialized name in order to avoid namespace clashes.
Type class which needs to be implemented by types that should be
usable for format string interpolation. For most types the this
class is simply implemented in terms of show
. But for
human-readable strings (e.g. String
, Text
), the format
representation is simply the string itself, not its show
-image
(which adds quotation characters).
formatText :: a -> Text Source #