Module

Data.TemplateString

Package
purescript-template-strings
Repository
purescripters/purescript-template-strings

#(<^>) Source

Operator alias for Data.TemplateString.template (non-associative / precedence 7)

#template Source

template :: String -> Array (Tuple String String) -> String

This is the safe version. The user is required to give a String representation of the object

Example:

> "${foo} ${bar}" <^> ["foo" /\ "the ${bar} was", "bar" /\ "bananas"]
= "the ${bar} was bananas"

#(<->) Source

Operator alias for Data.TemplateString.templateS (non-associative / precedence 7)

#templateS Source

templateS :: forall a. Show a => String -> Array (Tuple String a) -> String

This version can use any instance of Show

Example:

> "${one} and ${two}" <-> ["one" /\ 1, "two" /\ 2]
= "1 and 2"

#getTemplateVars Source

getTemplateVars :: String -> Array String

Get the template variables contained in a string.

Example:

> getTemplateVars "Foo ${bar} baz ${qux}"
= ["bar", "qux"]