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.Types

Contents
  1. Types for the Parser / Template
  2. Types for the Substitution / Data
  3. Converting
  4. Representation
Synopsis
  • Packagemustache-2.4.3.1
  • Exports24
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTypes.hs

Types for the Parser / Template

datadata Node α
Instances9Lift, Eq, Show, ToMustache, …

Types for the Substitution / Data

datadata Value

Internal value representation

Instances7Show, ToMustache, MonadReader, …

Converting

valueobject :: [Pair] -> Value

Convenience function for creating Object values.

This function is supposed to be used in conjuction with the ~> and ~= operators.

Examples
  data Address = Address { ... }

  instance Address ToJSON where
    ...

  data Person = Person { name :: String, address :: Address }

  instance ToMustache Person where
    toMustache (Person { name, address }) = object
      [ "name" ~> name
      , "address" ~= address
      ]

Here we can see that we can use the ~> operator for values that have themselves a ToMustache instance, or alternatively if they lack such an instance but provide an instance for the ToJSON typeclass we can use the ~= operator.

value(~=) :: ToJSON ι => Text -> ι -> Pair

Map keys to values that provide a ToJSON instance

Recommended in conjunction with the OverloadedStrings extension.

classclass ToMustache ω where

Conversion class

Instances47ToMustache, …

Representation

newtypenewtype SubM a
#
Instances6Monad, Functor, Applicative, ToMustache, MonadReader
datadata Context α

Representation of stateful context for the substitution process

Constructors

Instances8Eq, Ord, Show, ToMustache, MonadReader, …