Text.StringTemplate.Base: exported symbols usage examples

Symbols

  • stShowsToSE See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- Basic instances are provided of the StringTemplateShows and ToSElem class.
    -- Any type deriving ToSElem can be passed automatically as a StringTemplate
    -- attribute. This package can be installed with syb-with-class bindings
    -- that provide a ToSElem instance for anything deriving
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
    

    StringTemplateShows No usage example found for this symbol :( Collapse [-]
    Stringable No usage example found for this symbol :( Collapse [-]
    ToSElem No usage example found for this symbol :( Collapse [-]
    checkTemplate See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
    

    checkTemplateDeep See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
    

    dumpAttribs See 2 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    -- | Given an integral amount of seconds and a path, returns a group generating
    -- all files in said directory and subdirectories with the proper \"st\" extension,
    -- cached for that amount of seconds. IO errors are \"swallowed\" by this so
    -- that exceptions don't arise in unexpected places.
    -- This violates referential transparency, but can be very useful in developing
    -- templates for any sort of server application. It should be swapped out for
    -- production purposes. The dumpAttribs template is added to the returned group
    -- by default, as it should prove useful for debugging and developing templates.
    unsafeVolatileDirectoryGroup :: Stringable a => FilePath -> Int -> IO (STGroup a)
    unsafeVolatileDirectoryGroup path m = return . flip addSubGroup extraTmpls $ cacheSTGroup stfg
        where stfg = StFirst . Just . newSTMP . unsafePerformIO . flip CE.catch
                           (return . (\e -> "IO Error: " ++ show (ioeGetFileName e) ++ " -- " ++ ioeGetErrorString e))
                     . readFileUTF . (path </>) . (++".st")
              extraTmpls = addSubGroup (groupStringTemplates [("dumpAttribs", dumpAttribs)]) nullGroup
              delayTime :: Double
              delayTime = fromIntegral m
              cacheSTGroup :: STGroup a -> STGroup a
              cacheSTGroup g = unsafePerformIO $ do
                                 !ior <- newIORef M.empty
    

    getStringTemplate See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- attribute. This package can be installed with syb-with-class bindings
    -- that provide a ToSElem instance for anything deriving
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
    

    getStringTemplate' See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- attribute. This package can be installed with syb-with-class bindings
    -- that provide a ToSElem instance for anything deriving
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
    

    inSGen See 5 Occurences [+] Collapse [-]
    Found in Text.StringTemplate.Group from the package HStringTemplate
    addSubGroup f g = inSGen (g `mappend`) <$$> f
    
    -- | Merges two groups into a single group. This function is left-biased,
    -- prefering bindings from the first group when there is a conflict.
    mergeSTGroups :: STGroup a -> STGroup a -> STGroup a
    mergeSTGroups f g = addSuperGroup f g `mappend` addSubGroup g f
    
    -- | Adds a set of global options to a group
    optInsertGroup :: [(String, String)] -> STGroup a -> STGroup a
    optInsertGroup opts f = (inSGen (optInsertGroup opts) . optInsertTmpl opts) <$$> f
    
    -- | Sets an encoding function of a group that all values are
    -- rendered with in each enclosed template
    setEncoderGroup :: (Stringable a) => (a -> a) ->  STGroup a -> STGroup a
    setEncoderGroup x f = (inSGen (setEncoderGroup x) . setEncoder x) <$$> f
    
    -- | For any requested template, returns a message that the template was
    -- unable to be found. Useful to add as a super group for a set of templates
    -- under development, to aid in debugging.
    nullGroup :: Stringable a => STGroup a
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    addSuperGroup f g = inSGen (`mappend` g) <$$> f
    
    -- | Adds a \"subgroup\" to any StringTemplate group such that templates from
    -- the original group now have template calls \"shadowed\" by the subgroup.
    addSubGroup :: STGroup a -> STGroup a -> STGroup a
    addSubGroup f g = inSGen (g `mappend`) <$$> f
    
    -- | Merges two groups into a single group. This function is left-biased,
    -- prefering bindings from the first group when there is a conflict.
    mergeSTGroups :: STGroup a -> STGroup a -> STGroup a
    mergeSTGroups f g = addSuperGroup f g `mappend` addSubGroup g f
    
    -- | Adds a set of global options to a group
    optInsertGroup :: [(String, String)] -> STGroup a -> STGroup a
    optInsertGroup opts f = (inSGen (optInsertGroup opts) . optInsertTmpl opts) <$$> f
    
    -- | Sets an encoding function of a group that all values are
    -- rendered with in each enclosed template
    setEncoderGroup :: (Stringable a) => (a -> a) ->  STGroup a -> STGroup a
    setEncoderGroup x f = (inSGen (setEncoderGroup x) . setEncoder x) <$$> f
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    directoryGroupRecursiveLazy = directoryGroupRecursiveLazyExt ".st"
    
    -- | As with 'directoryGroupRecursiveLazy', but a template extension is supplied.
    directoryGroupRecursiveLazyExt :: (Stringable a) => FilePath -> FilePath -> IO (STGroup a)
    directoryGroupRecursiveLazyExt ext path = groupFromFiles readFileUTF =<< getTmplsRecursive ext "" path
    
    -- | Adds a supergroup to any StringTemplate group such that templates from
    -- the original group are now able to call ones from the supergroup as well.
    addSuperGroup :: STGroup a -> STGroup a -> STGroup a
    addSuperGroup f g = inSGen (`mappend` g) <$$> f
    
    -- | Adds a \"subgroup\" to any StringTemplate group such that templates from
    -- the original group now have template calls \"shadowed\" by the subgroup.
    addSubGroup :: STGroup a -> STGroup a -> STGroup a
    addSubGroup f g = inSGen (g `mappend`) <$$> f
    
    -- | Merges two groups into a single group. This function is left-biased,
    -- prefering bindings from the first group when there is a conflict.
    mergeSTGroups :: STGroup a -> STGroup a -> STGroup a
    mergeSTGroups f g = addSuperGroup f g `mappend` addSubGroup g f
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    directoryGroupRecursiveExt :: (Stringable a) => FilePath -> FilePath -> IO (STGroup a)
    directoryGroupRecursiveExt ext path = groupFromFiles readFile' =<< getTmplsRecursive ext "" path
    
    -- | See documentation for 'directoryGroupRecursive'.
    directoryGroupRecursiveLazy :: (Stringable a) => FilePath -> IO (STGroup a)
    directoryGroupRecursiveLazy = directoryGroupRecursiveLazyExt ".st"
    
    -- | As with 'directoryGroupRecursiveLazy', but a template extension is supplied.
    directoryGroupRecursiveLazyExt :: (Stringable a) => FilePath -> FilePath -> IO (STGroup a)
    directoryGroupRecursiveLazyExt ext path = groupFromFiles readFileUTF =<< getTmplsRecursive ext "" path
    
    -- | Adds a supergroup to any StringTemplate group such that templates from
    -- the original group are now able to call ones from the supergroup as well.
    addSuperGroup :: STGroup a -> STGroup a -> STGroup a
    addSuperGroup f g = inSGen (`mappend` g) <$$> f
    
    -- | Adds a \"subgroup\" to any StringTemplate group such that templates from
    -- the original group now have template calls \"shadowed\" by the subgroup.
    addSubGroup :: STGroup a -> STGroup a -> STGroup a
    addSubGroup f g = inSGen (g `mappend`) <$$> f
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
              subs <- concat <$> mapM (\x -> getTmplsRecursive ext (base </> x) (fp </> x)) subDirs
              return $ (map ((fp </>) &&& (\x -> base </> dropExtension x)) $
                        filter ((ext ==) . takeExtension) dirContents)
                       ++ subs
    
    {--------------------------------------------------------------------
      Group API
    --------------------------------------------------------------------}
    
    -- | Given a list of named of StringTemplates, returns a group which generates
    -- them such that they can call one another.
    groupStringTemplates :: [(String,StringTemplate a)] -> STGroup a
    groupStringTemplates xs = newGen
        where newGen s = StFirst (M.lookup s ng)
              ng = M.fromList $ map (second $ inSGen (`mappend` newGen)) xs
    
    -- | Given a path, returns a group which generates all files in said directory
    -- which have the proper \"st\" extension.
    -- This function is strict, with all files read once. As it performs file IO,
    -- expect it to throw the usual exceptions.
    

    newAngleSTMP See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- attribute. This package can be installed with syb-with-class bindings
    -- that provide a ToSElem instance for anything deriving
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
    

    newSTMP See 4 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- attribute. This package can be installed with syb-with-class bindings
    -- that provide a ToSElem instance for anything deriving
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    -- under development, to aid in debugging.
    nullGroup :: Stringable a => STGroup a
    nullGroup x = StFirst . Just . newSTMP $ "Could not find template: " ++ x
    
    -- | Given an integral amount of seconds and a path, returns a group generating
    -- all files in said directory and subdirectories with the proper \"st\" extension,
    -- cached for that amount of seconds. IO errors are \"swallowed\" by this so
    -- that exceptions don't arise in unexpected places.
    -- This violates referential transparency, but can be very useful in developing
    -- templates for any sort of server application. It should be swapped out for
    -- production purposes. The dumpAttribs template is added to the returned group
    -- by default, as it should prove useful for debugging and developing templates.
    unsafeVolatileDirectoryGroup :: Stringable a => FilePath -> Int -> IO (STGroup a)
    unsafeVolatileDirectoryGroup path m = return . flip addSubGroup extraTmpls $ cacheSTGroup stfg
        where stfg = StFirst . Just . newSTMP . unsafePerformIO . flip CE.catch
                           (return . (\e -> "IO Error: " ++ show (ioeGetFileName e) ++ " -- " ++ ioeGetErrorString e))
                     . readFileUTF . (path </>) . (++".st")
              extraTmpls = addSubGroup (groupStringTemplates [("dumpAttribs", dumpAttribs)]) nullGroup
              delayTime :: Double
              delayTime = fromIntegral m
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    -- | Adds a set of global options to a group
    optInsertGroup :: [(String, String)] -> STGroup a -> STGroup a
    optInsertGroup opts f = (inSGen (optInsertGroup opts) . optInsertTmpl opts) <$$> f
    
    -- | Sets an encoding function of a group that all values are
    -- rendered with in each enclosed template
    setEncoderGroup :: (Stringable a) => (a -> a) ->  STGroup a -> STGroup a
    setEncoderGroup x f = (inSGen (setEncoderGroup x) . setEncoder x) <$$> f
    
    -- | For any requested template, returns a message that the template was
    -- unable to be found. Useful to add as a super group for a set of templates
    -- under development, to aid in debugging.
    nullGroup :: Stringable a => STGroup a
    nullGroup x = StFirst . Just . newSTMP $ "Could not find template: " ++ x
    
    -- | Given an integral amount of seconds and a path, returns a group generating
    -- all files in said directory and subdirectories with the proper \"st\" extension,
    -- cached for that amount of seconds. IO errors are \"swallowed\" by this so
    -- that exceptions don't arise in unexpected places.
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    readFileUTF :: FilePath -> IO String
    readFileUTF f = do
       h <- openFile f ReadMode
       hSetEncoding h utf8
       hGetContents h
    
    readFile' :: FilePath -> IO String
    readFile' f = do
       x <- readFileUTF f
       length x `seq` return x
    
    groupFromFiles :: Stringable a => (FilePath -> IO String) -> [(FilePath,String)] -> IO (STGroup a)
    groupFromFiles rf fs = groupStringTemplates <$> forM fs  (\(f,fname) -> do
         stmp <- newSTMP <$> rf f
         return (fname, stmp))
    
    getTmplsRecursive :: FilePath -> FilePath -> FilePath -> IO [(FilePath, FilePath)]
    getTmplsRecursive ext base fp = do
              dirContents <- filter (not . isPrefixOf ".") <$> getDirectoryContents fp
    

    optInsertTmpl See 2 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
      groupStringTemplates, addSuperGroup, addSubGroup,
      mergeSTGroups, directoryGroup, directoryGroupExt,
      unsafeVolatileDirectoryGroup,
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    addSuperGroup f g = inSGen (`mappend` g) <$$> f
    
    -- | Adds a \"subgroup\" to any StringTemplate group such that templates from
    -- the original group now have template calls \"shadowed\" by the subgroup.
    addSubGroup :: STGroup a -> STGroup a -> STGroup a
    addSubGroup f g = inSGen (g `mappend`) <$$> f
    
    -- | Merges two groups into a single group. This function is left-biased,
    -- prefering bindings from the first group when there is a conflict.
    mergeSTGroups :: STGroup a -> STGroup a -> STGroup a
    mergeSTGroups f g = addSuperGroup f g `mappend` addSubGroup g f
    
    -- | Adds a set of global options to a group
    optInsertGroup :: [(String, String)] -> STGroup a -> STGroup a
    optInsertGroup opts f = (inSGen (optInsertGroup opts) . optInsertTmpl opts) <$$> f
    
    -- | Sets an encoding function of a group that all values are
    -- rendered with in each enclosed template
    setEncoderGroup :: (Stringable a) => (a -> a) ->  STGroup a -> STGroup a
    setEncoderGroup x f = (inSGen (setEncoderGroup x) . setEncoder x) <$$> f
    

    paddedTrans No usage example found for this symbol :( Collapse [-]
    parseSTMP No usage example found for this symbol :( Collapse [-]
    parseSTMPNames See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate.QQ from the package HStringTemplate
    import qualified Language.Haskell.TH as TH
    import Language.Haskell.TH.Quote
    import Text.StringTemplate.Base
    import qualified Data.Set as S
    
    quoteTmplExp :: String -> TH.ExpQ
    quoteTmplPat :: String -> TH.PatQ
    
    stmp :: QuasiQuoter
    stmp = QuasiQuoter {quoteExp = quoteTmplExp, quotePat = quoteTmplPat}
    
    quoteTmplPat = error "Cannot apply stmp quasiquoter in patterns"
    quoteTmplExp s = return tmpl
      where
        vars = case parseSTMPNames ('$','$') s of
                 Right (xs,_,_) -> xs
                 Left  err -> fail $ show err
        base  = TH.AppE (TH.VarE (TH.mkName "Text.StringTemplate.newSTMP")) (TH.LitE (TH.StringL s))
        tmpl  = S.foldr addAttrib base $ S.fromList vars
        addAttrib var = TH.AppE
    

    render See 2 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
    

    Found in Text.StringTemplate.Renderf from the package HStringTemplate
    {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
    module Text.StringTemplate.Renderf ((|=), SEType(..)) where
    import Text.StringTemplate.Base
    
    class Stringable b => SEType b a where
        renderf :: StringTemplate b -> a
    instance Stringable a => SEType a a where
        renderf = render
    instance Stringable a => SEType a (StringTemplate a) where
        renderf = id
    instance (ToSElem a, SEType b r) => SEType b ((String, a) -> r) where
        renderf x (k, v) = renderf $ setAttribute k v x
    

    setAttribute See 2 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
    

    Found in Text.StringTemplate.Renderf from the package HStringTemplate
    {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
    module Text.StringTemplate.Renderf ((|=), SEType(..)) where
    import Text.StringTemplate.Base
    
    class Stringable b => SEType b a where
        renderf :: StringTemplate b -> a
    instance Stringable a => SEType a a where
        renderf = render
    instance Stringable a => SEType a (StringTemplate a) where
        renderf = id
    instance (ToSElem a, SEType b r) => SEType b ((String, a) -> r) where
        renderf x (k, v) = renderf $ setAttribute k v x
    
    (|=) :: (Monad m) => a -> m a1 -> m (a, a1)
    k |= v = return . (,) k =<< v
    infixl 5 |=
    

    setEncoder See 2 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
      groupStringTemplates, addSuperGroup, addSubGroup,
      mergeSTGroups, directoryGroup, directoryGroupExt,
      unsafeVolatileDirectoryGroup,
      directoryGroupRecursive, directoryGroupRecursiveLazy,
    

    Found in Text.StringTemplate.Group from the package HStringTemplate
    addSubGroup f g = inSGen (g `mappend`) <$$> f
    
    -- | Merges two groups into a single group. This function is left-biased,
    -- prefering bindings from the first group when there is a conflict.
    mergeSTGroups :: STGroup a -> STGroup a -> STGroup a
    mergeSTGroups f g = addSuperGroup f g `mappend` addSubGroup g f
    
    -- | Adds a set of global options to a group
    optInsertGroup :: [(String, String)] -> STGroup a -> STGroup a
    optInsertGroup opts f = (inSGen (optInsertGroup opts) . optInsertTmpl opts) <$$> f
    
    -- | Sets an encoding function of a group that all values are
    -- rendered with in each enclosed template
    setEncoderGroup :: (Stringable a) => (a -> a) ->  STGroup a -> STGroup a
    setEncoderGroup x f = (inSGen (setEncoderGroup x) . setEncoder x) <$$> f
    
    -- | For any requested template, returns a message that the template was
    -- unable to be found. Useful to add as a super group for a set of templates
    -- under development, to aid in debugging.
    nullGroup :: Stringable a => STGroup a
    

    setManyAttrib See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
    

    setManyNativeAttrib See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
      groupStringTemplates, addSuperGroup, addSubGroup,
    

    setNativeAttribute See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
      groupStringTemplates, addSuperGroup, addSubGroup,
    

    toPPDoc See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
    

    toString See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
    -- ToSElem that can take a format parameter, you should first define an
    -- instance of StringTemplateShows, and then define an instance of ToSElem
    -- where @ toSElem = stShowsToSE@.
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
    

    withContext See 1 Occurences [+] Collapse [-]
    Found in Text.StringTemplate from the package HStringTemplate
    -----------------------------------------------------------------------------
    
    module Text.StringTemplate (
      -- * Types
      StringTemplate, STGroup,
      -- * Classes
      ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
      -- * Creation
      newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
      -- * Display
      toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
      -- * Modification
      setAttribute, (|=), setManyAttrib,
      setNativeAttribute, setManyNativeAttrib,
      withContext,
      optInsertTmpl, optInsertGroup,
      setEncoder, setEncoderGroup,
      -- * Groups
      groupStringTemplates, addSuperGroup, addSubGroup,
      mergeSTGroups, directoryGroup, directoryGroupExt,
    

    SEnv No usage example found for this symbol :( Collapse [-]
    STGroup No usage example found for this symbol :( Collapse [-]
    StringTemplate No usage example found for this symbol :( Collapse [-]