fillit-0.1.0.0: Flexible string substitution
Data.Text.Fillit
Synopsis
type Template = Text Source #
type Dict = HashMap Text Text Source #
data Config Source #
Constructors
Fields
Instances
Methods
def :: Config #
def :: Default a => a #
The default value for this type.
fill :: Template -> Dict -> Either String Text Source #
>>> fill "Hi, $name$" dic Right "Hi, Tom"
>>>
fill "Hi, $name$" dic
>>> fill "$date$: %note%" dic Right "2017-08-01 12:00: %note%"
fill "$date$: %note%" dic
>>> fill "%date% $name$" dic Right "2017-08-01 12:00 Tom"
fill "%date% $name$" dic
>>> fill "$name$ ($age$)" dic Left ...
fill "$name$ ($age$)" dic
fill' :: Config -> Template -> Dict -> Either String Text Source #
>>> :{ let config = Config { reqFrom = "<<" , reqTo = ">>" , optFrom = "{{" , optTo = "}}" } in fill' config "Hi, <<name>>" dic :} Right "Hi, Tom"
:{