-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | A type-safe template engine for working with front end development tools
--   
--   Recent front end development tools and languages are growing fast and
--   have quite a complicated ecosystem. Few front end developers want to
--   be forced use Shakespeare templates. Instead, they would rather use
--   node-friendly engines such that pug, slim,
--   and haml. However, in using these template engines, we lose
--   the compile-time variable interpolation and type checking from
--   Shakespeare.
--   
--   Heterocephalus is intended for use with another feature rich template
--   engine and provides a way to interpolate server side variables into a
--   precompiled template file with forall, if, and
--   case statements.
@package heterocephalus
@version 1.0.5.7

-- | This module exports functions for working with frontend templates from
--   Haskell.
module Text.Heterocephalus

-- | A function to compile template file. This function DOES NOT
--   escape template variables. To render the compiled file, use
--   Renderer.*.renderMarkup.
--   
--   
--   >>> putStr $ renderMarkup (let as = ["<a>", "b"] in $(compileTextFile "templates/sample.txt"))
--   sample
--   key: <a>,
--   key: b,
--   
compileTextFile :: FilePath -> Q Exp

-- | Same as compileText but allows the user to specify extra values
--   for template parameters. Values declared by overwrite
--   overwrites same name variables. Values declared by setDefault
--   are overwritten by same name variables.
--   
--   
--   >>> :set -XOverloadedStrings
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileTextFileWith "templates/sample.txt" $ do
--       setDefault "as" [| ["foo", "bar"] |]
--     )
--   )
--   :}
--   sample
--   key: <a>,
--   key: b,
--   
--   
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileTextFileWith "templates/sample.txt" $ do
--       overwrite "as" [| ["foo", "bar"] |]
--     )
--   )
--   :}
--   sample
--   key: foo,
--   key: bar,
--   
--   
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileTextFileWith "templates/sample.txt" $ do
--       overwrite "as" [| ["bazbaz", "barbar"] |]
--       setDefault "as" [| ["foo", "bar"] |]
--       overwrite "as" [| ["baz", "foobar"] |]
--     )
--   )
--   :}
--   sample
--   key: baz,
--   key: foobar,
--   
compileTextFileWith :: FilePath -> ScopeM () -> Q Exp

-- | Same as compileText but allows the user to specify default
--   values for template parameters.
--   
--   
--   >>> :set -XOverloadedStrings
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileTextFileWithDefault "templates/sample.txt"
--       [("as", [| ["foo", "bar"] |])]
--     )
--   )
--   :}
--   sample
--   key: <a>,
--   key: b,
--   
--   
--   
--   >>> :{
--   putStr $ renderMarkup (
--     $(compileTextFileWithDefault "templates/sample.txt"
--       [("as", [| ["foo", "bar"] |])]
--     )
--   )
--   :}
--   sample
--   key: foo,
--   key: bar,
--   
compileTextFileWithDefault :: FilePath -> DefaultScope -> Q Exp

-- | Same as compileTextFile but escapes template variables in HTML.
--   
--   
--   >>> putStr $ renderMarkup (let as = ["<a>", "b"] in $(compileHtmlFile "templates/sample.txt"))
--   sample
--   key: &lt;a&gt;,
--   key: b,
--   
compileHtmlFile :: FilePath -> Q Exp

-- | Same as compileHtmlFile but allows the user to specify extra
--   values for template parameters. Values declared by overwrite
--   overwrites same name variables. Values declared by setDefault
--   are overwritten by same name variables.
--   
--   
--   >>> :set -XOverloadedStrings
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileHtmlFileWith "templates/sample.txt" $ do
--       setDefault "as" [| ["foo", "bar"] |]
--     )
--   )
--   :}
--   sample
--   key: &lt;a&gt;,
--   key: b,
--   
--   
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileHtmlFileWith "templates/sample.txt" $ do
--       overwrite "as" [| ["foo", "bar"] |]
--     )
--   )
--   :}
--   sample
--   key: foo,
--   key: bar,
--   
--   
--   
--   >>> :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileHtmlFileWith "templates/sample.txt" $ do
--       overwrite "as" [| ["bazbaz", "barbar"] |]
--       setDefault "as" [| ["foo", "bar"] |]
--       overwrite "as" [| ["baz", "foobar"] |]
--     )
--   )
--   :}
--   sample
--   key: baz,
--   key: foobar,
--   
compileHtmlFileWith :: FilePath -> ScopeM () -> Q Exp

-- | Same as compileHtmlFile but allows the user to specify default
--   values for template parameters.
--   
--   
--   >>> :set -XOverloadedStrings
--   :{
--   putStr $ renderMarkup (
--     let as = ["<a>", "b"]
--     in $(compileHtmlFileWithDefault "templates/sample.txt"
--       [("as", [| ["foo", "bar"] |])]
--     )
--   )
--   :}
--   sample
--   key: &lt;a&gt;,
--   key: b,
--   
--   
--   
--   >>> :{
--   putStr $ renderMarkup (
--     $(compileHtmlFileWithDefault "templates/sample.txt"
--       [("as", [| ["foo", "bar"] |])]
--     )
--   )
--   :}
--   sample
--   key: foo,
--   key: bar,
--   
compileHtmlFileWithDefault :: FilePath -> DefaultScope -> Q Exp

-- | Heterocephalus quasi-quoter. This function DOES NOT escape
--   template variables. To render the compiled file, use
--   Renderer.*.renderMarkup.
--   
--   
--   >>> renderMarkup (let as = ["<a>", "b"] in [compileText|sample %{ forall a <- as }key: #{a}, %{ endforall }|])
--   "sample key: <a>, key: b, "
--   
--   
--   
--   >>> renderMarkup (let num=2 in [compileText|#{num} is %{ if even num }an even number.%{ elseif (num > 100) }big.%{ else }an odd number.%{ endif }|])
--   "2 is an even number."
--   
compileText :: QuasiQuoter

-- | Heterocephalus quasi-quoter for HTML. Same as compileText but
--   this function does escape template variables in HTML.
--   
--   
--   >>> renderMarkup (let as = ["<a>", "b"] in [compileHtml|sample %{ forall a <- as }key: #{a}, %{ endforall }|])
--   "sample key: &lt;a&gt;, key: b, "
--   
compileHtml :: QuasiQuoter

-- | A type to handle extra scopes. This is opaque type, so use
--   setDefault and overwrite to construct new ScopeM.
data ScopeM a

-- | Constructor for ScopeM. Values declared by this function are
--   overwritten by same name variables exits in scope of render function.
setDefault :: Ident -> Q Exp -> ScopeM ()

-- | Constructor for ScopeM. Values declared by this function
--   overwrites same name variables exits in scope of render function.
overwrite :: Ident -> Q Exp -> ScopeM ()

-- | Settings that are used when processing heterocephalus templates.
data HeterocephalusSetting
HeterocephalusSetting :: Q Exp -> ParseOptions -> HeterocephalusSetting

-- | Template variables are passed to escapeExp in the output. This
--   allows things like escaping HTML entities. (See htmlSetting.)
[escapeExp] :: HeterocephalusSetting -> Q Exp
[parseOptions] :: HeterocephalusSetting -> ParseOptions

-- | A setting that DOES NOT escape template variables.
--   
--   This sets escapeExp to preEscapedToMarkup.
textSetting :: HeterocephalusSetting

-- | A setting that escapes template variables for Html
--   
--   This sets escapeExp to toHtml.
htmlSetting :: HeterocephalusSetting
data ParseOptions
ParseOptions :: Char -> Char -> ParseOptions
[parseOptionsControlPrefix] :: ParseOptions -> Char
[parseOptionsVariablePrefix] :: ParseOptions -> Char

-- | Default set of parser options.
--   
--   Sets parseOptionsControlPrefix to '%' and
--   parseOptionsVariablePrefix to '#'.
defaultParseOptions :: ParseOptions
createParseOptions :: Char -> Char -> ParseOptions
type DefaultScope = [(Ident, Q Exp)]
compile :: HeterocephalusSetting -> QuasiQuoter

-- | QuasiQuoter.
compileWith :: ScopeM () -> HeterocephalusSetting -> QuasiQuoter

-- | QuasiQuoter.
compileWithDefault :: DefaultScope -> HeterocephalusSetting -> QuasiQuoter

-- | Compile a template file.
compileFile :: HeterocephalusSetting -> FilePath -> Q Exp

-- | Same as compileFile but we can specify default scope.
compileFileWith :: ScopeM () -> HeterocephalusSetting -> FilePath -> Q Exp

-- | Same as compileFile but we can specify default scope.
compileFileWithDefault :: DefaultScope -> HeterocephalusSetting -> FilePath -> Q Exp

-- | Same as compileFile, but just compile the String given.
--   
--   
--   >>> let as = ["<a>", "b"]
--   
--   >>> let template = "sample %{ forall a <- as }key: #{a}, %{ endforall }"
--   
--   >>> renderMarkup $(compileFromString textSetting template)
--   "sample key: <a>, key: b, "
--   
--   
--   
--   >>> let as = ["<a>", "b"]
--   
--   >>> let options = createParseOptions '|' '?'
--   
--   >>> let setting = textSetting { parseOptions = options }
--   
--   >>> let template = "sample |{ forall a <- as }key: ?{a}, |{ endforall }"
--   
--   >>> renderMarkup $(compileFromString setting template)
--   "sample key: <a>, key: b, "
--   
compileFromString :: HeterocephalusSetting -> String -> Q Exp
compileFromStringWithDefault :: DefaultScope -> HeterocephalusSetting -> String -> Q Exp
instance GHC.Internal.Base.Applicative Text.Heterocephalus.ScopeM
instance GHC.Internal.Base.Functor Text.Heterocephalus.ScopeM
instance GHC.Internal.Data.String.IsString Text.Shakespeare.Base.Ident
instance GHC.Internal.Base.Monad Text.Heterocephalus.ScopeM
instance GHC.Internal.Base.Monoid (Text.Heterocephalus.ScopeM ())
instance GHC.Internal.Base.Semigroup (Text.Heterocephalus.ScopeM ())
instance GHC.Internal.Show.Show (Text.Heterocephalus.VarExp msg url)
