-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A tiny text templating library -- @package tinytemplate @version 0.1.2.0 -- | Templates can be created in code using the lit and -- placeholder functions with the Monoid instance, or by -- parsing a template string: -- --
-- import Data.Monoid ((<>))
--
-- t1 = placeholder "lastName" <> lit ", " <> placeholder "firstName"
-- t2 = parseTemplate "{{lastName}}, {{firstName}}"
--
--
-- Templates can be applied using the applyTemplate function:
--
--
-- >>> :set -XOverloadedStrings
--
-- >>> let vals = [("firstName", "Haskell"), ("lastName", "Curry")]
--
-- >>> applyTemplate (`lookup` vals) t1
-- Just "Curry, Haskell"
--
module Data.Text.Template
-- | A text template
data Template
-- | Create a Template from a literal string
lit :: Text -> Template
-- | Create a Template from a placeholder which will be replaced
-- during rendering
placeholder :: Text -> Template
-- | Parse a Template from a template string.
--
-- Placeholders are represented using double-curly-braces ({{ ...
-- }}) and everything else is considered literal text.
parseTemplate :: Text -> Template
-- | Traverse a Template, replacing placeholders using the specified
-- function.
applyTemplate :: Applicative f => (Text -> f Text) -> Template -> f Text
-- | Render a Template as a template string.
printTemplate :: Template -> Text
instance Show TemplatePart
instance Eq TemplatePart
instance Ord TemplatePart
instance Show Template
instance Eq Template
instance Ord Template
instance Applicative Id
instance Functor Id
instance Monoid Template