HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulemustache-2.4.3.1Haskell2010

Text.Mustache.Render

Contents
  1. Substitution
  2. Checked substitution
  3. Working with Context
  4. Util
Synopsis
  • Packagemustache-2.4.3.1
  • Exports13
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceRender.hs

Substitution

valuesubstitute :: ToMustache k => Template -> k -> Text

Substitutes all mustache defined tokens (or tags) for values found in the provided data structure.

Equivalent to substituteValue . toMustache.

Checked substitution

Substitutes all mustache defined tokens (or tags) for values found in the provided data structure and report any errors and warnings encountered during substitution.

This function always produces results, as in a fully substituted/rendered template, it never halts on errors. It simply reports them in the first part of the tuple. Sites with errors are usually substituted with empty string.

The second value in the tuple is a template rendered with errors ignored. Therefore if you must enforce that there were no errors during substitution you must check that the error list in the first tuple value is empty.

Equivalent to checkedSubstituteValue . toMustache.

Substitutes all mustache defined tokens (or tags) for values found in the provided data structure and report any errors and warnings encountered during substitution.

This function always produces results, as in a fully substituted/rendered template, it never halts on errors. It simply reports them in the first part of the tuple. Sites with errors are usually substituted with empty string.

The second value in the tuple is a template rendered with errors ignored. Therefore if you must enforce that there were no errors during substitution you must check that the error list in the first tuple value is empty.

Type of errors we may encounter during substitution.

Constructors

Instances1Show

Working with Context

datadata Context α

Representation of stateful context for the substitution process

Constructors

Instances8Eq, Ord, Show, ToMustache, MonadReader, …
valuesearch :: [Key] -> SubM (Maybe Value)

Search for a key in the current context.

The search is conducted inside out mening the current focus is searched first. If the key is not found the outer scopes are recursively searched until the key is found, then innerSearch is called on the result.

valueinnerSearch :: [Key] -> Value -> Maybe Value

Searches nested scopes navigating inward. Fails if it encunters something other than an object before the key is expended.

newtypenewtype SubM a
#
Instances6Monad, Functor, Applicative, ToMustache, MonadReader

Util

Orphan instances

5 instances