Support for parsing and rendering YAML documents. http://github.com/snoyberg/yaml/

Version on this page:
LTS Haskell 9.14:0.8.25
Stackage Nightly 2017-11-18:0.8.25
Latest on Hackage:0.8.25
BSD3 licensed by Michael Snoyman, Anton Ageev, Kirill Simonov


Provides support for parsing and emitting Yaml documents.

This package includes the full libyaml C library version 0.1.7 by Kirill Simonov in the package so you don't need to worry about any non-Haskell dependencies.

The package is broken down into two primary modules. Data.Yaml provides a high-level interface based around the JSON datatypes provided by the aeson package. Text.Libyaml provides a lower-level, streaming interface. For most users, Data.Yaml is recommended.


Usage examples can be found in the Data.Yaml documentation or in the examples directory.

Additional modules

  • Data.Yaml.Include supports adding !include directives to your YAML files.
  • Data.Yaml.Builder and Data.Yaml.Parser allow more fine-grained control of parsing an rendering, as opposed to just using the aeson typeclass and datatype system for parsing and rendering.
  • Data.Yaml.Aeson is currently a re-export of Data.Yaml to explicitly choose to use the aeson-compatible API.



  • Tweaks to the executable yaml2json #119:
    • Add command-line option -h and --help to show help message
    • Error messages are now written to stderr instead of stdout


  • New encodePretty option setConfDropNull to drop null values from objects #116

  • Avoid over-escaping * #113

  • Update CPP MIN_VERSION_* checks #109


  • Re-export the with helpers from aeson

  • Make numeric string detection slightly smarter so, e.g., . does not get quoted


  • Update to libyaml hosted on Github #105

  • Fix wrong file not found exception in Data.Yaml.Include with pre- directory #104

  • Add missing test files #102


  • Decode empty inputs as Null #101


  • Upgrade to libyaml 0.1.7

  • Add Data.Yaml.TH module

  • Add O_TRUNC when opening files

  • s/fdopen/_fdopen on Windows #96

  • Properly fix previous bug (fixes #94)

  • Remove file with non-ASCII name due to Stack/cabal-install/Hackage restrictions (see #92)

  • Handle non-ASCII filenames correctly on Windows #91

  • Improve prettyPrintParseException when context is empty #89


  • Switched yaml decode function for config file readers in Data.Yaml.Config to the one from Data.Yaml.Include that supports !include syntax.

  • Fix pretty-printing order of UnexpectedEvent's fields (fixes #84) #85

  • Avoid bug in Cabal #83


  • loadYamlSettingsArgs

  • Slight doc improvement


Add env variable parsing. loadYamlSettings can read config values from the environment with Yaml that specifies an env var. The syntax is

var: _env:ENV_VAR:default

  • Give a warning when compiling with GHCJS

  • Canonicalise Monad instances #76

  • Compile with aeson below 0.7 #70


  • Parse Scientific directly, avoiding loss in precision. #68


  • Pretty print improvements for exceptions #67


  • Pretty module #66


  • Proper handling of String "+123" #64


  • Function to print prettier parse exceptions #59


Add the Data.Yaml.Include module

Used by 162 packages:
alga, amazonka-test, aws-ec2, b9, batchd, battleships, brittany, buchhaltung, Buster, cabal2ghci, cabal2nix, canteven-config, canteven-log, celtchar, citation-resolve, citeproc-hs-pandoc-filter, cloud-seeder, codex, color-counter, configifier, configuration-tools, craft, data-object-yaml, dhall-json, dixi, domplate, ert, feed-gipeda, frontmatter, gipeda, gli, groundhog-th, hakyll, hamsql, hannahci, hapistrano, haskell-formatter, haskoin-wallet, haskus-system-build, hfmt, hindent, hledger-web, hlint, hnormalise, hoobuddy, hopenpgp-tools, hpack, hpack-convert, hpaco, Hydrogen, iridium, jenga, json2yaml, json-autotype, json-extra, kafka-device-joystick, kafka-device-spacenav, keiretsu, keter, khph, kit, kontra-config, language-conf, language-dockerfile, language-puppet, legion-extra, libmolude, log-warper, lord, loup, lxd-client-config, macbeth-lib, mega-sdist, mida, mmark, moonshine, morph, mustache, network-builder, nomyx-api, nomyx-core, notmuch-web, nvim-hs-contrib, nvim-hs-ghcid, octohat, omnifmt, orgstat, otp-authenticator, pandoc, pandoc-citeproc, pansite, patat, pdf-slave, pdf-slave-server, pit, platinum-parsing, pocket-dns, pushme, puzzle-draw, puzzle-draw-cmdline, quickbooks, raml, Saturnin, sbp, scholdoc, scholdoc-citeproc, SciFlow, serokell-util, servant-yaml, sitepipe, sprinkles, sproxy, sproxy2, stack, stack2nix, stackage2nix, stackage-build-plan, stackage-curator, stackage-metadata, stackage-query, stackage-setup, stack-bump, stack-hpc-coveralls, staversion, steeloverseer, stylish-haskell, styx, tempered, test-sandbox-compose, tn, travis-meta-yaml, tttool, ua-parser, unused, vgrep, vimeta, wacom-daemon, wai-middleware-auth, wallpaper, weeder, wobsurv, wolf, Yablog, yackage, yaml, yaml2owl, yaml-combinators, yaml-config, yamlkeysdiff, yaml-rpc, yaml-rpc-scotty, yaml-rpc-snap, yaml-union, yesod, yesod-bin, yesod-mangopay, yesod-platform, yesod-raml, yesod-raml-bin, yesod-raml-docs, yesod-raml-mock, yst
comments powered byDisqus