Safe Haskell | None |
---|---|
Language | Haskell2010 |
formerly Format
substitutes placeholder values with values from args
in lieu of format function there are 2 operators: <
and >
: no need to remember arg order.
placeholder syntax:
index based
{ Int }
key based
{
String
|ByteString
|Text
}
other placeholders may be implemented with
Text.Regex.Do.Replace.Latin or Text.Regex.Do.Replace.Utf8
to avoid clash with Prelude
:
import Prelude hiding((<),(>))
or qualify <
with alias e.g. (assuming this module is imported with F alias):
F.<
Synopsis
- class Template a repl where
- class ReplaceOne idx a
- type Formatable a = (Template a [a], Template a [(a, a)])
Documentation
class Template a repl where Source #
Instances
ReplaceOne a a => Template a [(a, a)] Source # | key basedkey may be {any a}
"овчинка выделки не стоит" |
ReplaceOne Int a => Template a [a] Source # | index based
"даме цветы, детям мороженое"
"Polly wants a cracker"
"на первое перловка, на второе перловка" |
class ReplaceOne idx a Source #
replaceOne
Instances
ReplaceOne Int String Source # | |
Defined in Text.Regex.Do.Replace.Template replaceOne :: String -> Int -> String -> String | |
ReplaceOne Int ByteString Source # | |
Defined in Text.Regex.Do.Replace.Template replaceOne :: ByteString -> Int -> ByteString -> ByteString | |
ReplaceOne Int Text Source # | |
Defined in Text.Regex.Do.Replace.Template replaceOne :: Text -> Int -> Text -> Text | |
ReplaceOne String String Source # | |
Defined in Text.Regex.Do.Replace.Template replaceOne :: String -> String -> String -> String | |
ReplaceOne ByteString ByteString Source # | |
Defined in Text.Regex.Do.Replace.Template replaceOne :: ByteString -> ByteString -> ByteString -> ByteString | |
ReplaceOne Text Text Source # | |
Defined in Text.Regex.Do.Replace.Template replaceOne :: Text -> Text -> Text -> Text |
type Formatable a = (Template a [a], Template a [(a, a)]) Source #