mustache-haskell: Straight implementation of mustache templates

[ library, mit, program, text ] [ Propose Tags ]

Straight implementation of mustache templates

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],,,,,
Dependencies aeson, base (>=4.7 && <4.8), bytestring, directory, mustache-haskell, optparse-applicative (>=0.11.0 && <0.12.0), parsec, pretty-show, scientific (>= && <, text, transformers, unordered-containers, vector [details]
License MIT
Author Daniel Choi
Category Text
Home page
Uploaded by DanielChoi at 2014-12-11T20:26:21Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables mus
Downloads 3928 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2014-12-11 [all 2 reports]

Readme for mustache-haskell-

[back to package description]


A Haskell implementation of mustache templates. Expects input data to be JSON.

Should be compatible with the the mustache specification. Except lambdas are not supported.

Supported syntax:

  • basic variables
  • sections
  • inverted sections
  • comments (are suppressed)
  • partials
  • set delimiter

This project currently only provides a command line interface. Later versions will provide a library API for templating ToJSON instances.


You need the Haskell platform on your system.

cabal install mustache-haskell

Or alternatively

git clone
cd mustache-haskell
cabal sandbox init
cabal install
# Now copy .cabal-sandbox/bin/mus to your PATH


mus template.mustache < input.json

  A Haskell implementation of Mustache templates. On STDIN provide the JSON to
  insert into the template.

Available options:
  -h,--help                Show this help text
  -c                       Just output parse tree of template file
  -d TEMPLATE_DIRECTORY    Template directory

List separator syntax

mustache-haskell adds one additional feature to the mustache specification. If you are outputing elements of a list, you can designate an optional list separator with the following syntax:

{{#hobbies, }}{{name}}{{/hobbies}}

This designates ", " as the list separator and will output

sewing, brewing, cooking

when the input is



In a few informal tests,

mus template.mustache < input.json

is about 10x faster than the Ruby mustache gem command-line implementation,

mustache - template.mustache < input.json
  • whiskers Mustache templates with Template Haskell (reddit)
  • hastache Haskell implementation of Mustache templates
  • mustache2hs takes in Haskell records (single data constructor only) and a list of mustache template and record name pairs, and generates Haskell code for functions that take an escape function and one of the records
  • mustache.go an implementation of the mustache template language in Go