HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulestache-2.3.4Haskell2010

Text.Mustache.Compile.TH

Template Haskell helpers to compile Mustache templates at compile time. This module is not imported as part of Text.Mustache, so you need to import it yourself. Qualified import is recommended, but not necessary.

  • 5 values
  • Packagestache-2.3.4
  • Exports5
  • LanguageHaskell2010
  • LicenceMIT
  • SourceTH.hs
valuecompileMustacheDir
  1. :: PName

    Which template to select after compiling

  2. -> FilePath

    Directory with templates

  3. -> Q Exp

    The resulting template

#

Compile all templates in the specified directory and select one. Template files should have the extension mustache, (e.g. foo.mustache) to be recognized. This function does not scan the directory recursively.

This version compiles the templates at compile time.

compileMustacheDir = compileMustacheDir' isMustacheFile
valuecompileMustacheDir'
  1. :: (FilePath -> Bool)

    Template selection predicate

  2. -> PName

    Which template to select after compiling

  3. -> FilePath

    Directory with templates

  4. -> Q Exp

    The resulting template

#

The same as compileMustacheDir, but allows using a custom predicate for template selection.

This version compiles the templates at compile time.

valuecompileMustacheFile
  1. :: FilePath

    Location of the file

  2. -> Q Exp
#

Compile a Mustache template and select it.

This version compiles the template at compile time.

valuecompileMustacheText
  1. :: PName

    How to name the template?

  2. -> Text

    The template to compile

  3. -> Q Exp
#

Compile a Mustache template from Text value. The cache will contain only this template named according to given Key.

This version compiles the template at compile time.

valuemustache :: QuasiQuoter
#

Compile a Mustache using a QuasiQuoter. Usage:

{-# LANGUAGE QuasiQuotes #-}
import Text.Mustache.Compile.TH (mustache)

foo :: Template
foo = [mustache|This is my inline {{ template }}.|]

Name of created partial is set to "quasi-quoted". You can extend cache of Template created this way using (Data.Semigroup.<>) and so work with partials as usual.