HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulemustache-2.4.3.1Haskell2010

Text.Mustache.Types

  • 13 types
  • 1 class
  • 9 values
  • Packagemustache-2.4.3.1
  • Exports24
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTypes.hs

Types for the Parser / Template

6 declarations
datadata Node α
#
Instances9Lift, Eq, Show, ToMustache, …

Types for the Substitution / Data

2 declarations
datadata Value
#

Internal value representation

Instances7Show, ToMustache, MonadReader, …
typetype Key = Text
#

Type of key used for retrieving data from Values

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(~>) :: ToMustache ω => Text -> ω -> Pair
#

Map keys to values that provide a ToMustache instance

Recommended in conjunction with the OverloadedStrings extension.

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, …
valuemFromJSON :: ToJSON ι => ι -> Value
#

Converts a value that can be represented as JSON to a Value.

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, …