HsYAML
Pure Haskell YAML 1.2 processor
https://github.com/haskell-hvr/HsYAML
| LTS Haskell 24.16: | 0.2.1.5@rev:1 |
| Stackage Nightly 2025-10-24: | 0.2.1.5@rev:1 |
| Latest on Hackage: | 0.2.1.5@rev:1 |
HsYAML-0.2.1.5@sha256:ca7cbb5bfdc89a9fc21e60642fafd4accf09ee489182513ae3790416147ab1d0,5407Module documentation for 0.2.1.5
HsYAML is a YAML 1.2 processor, i.e. a library for parsing and serializing YAML documents.
Features of HsYAML include:
Pure Haskell implementation with small dependency footprint and emphasis on strict compliance with the YAML 1.2 specification.
Direct decoding to native Haskell types via (
aeson-inspired) typeclass-based API (seeData.YAML).Allows round-tripping while preserving ordering, anchors, and comments at Event-level.
Support for constructing custom YAML node graph representation (including support for cyclic YAML data structures).
Support for the standard (untyped) Failsafe, (strict) JSON, and (flexible) Core "schemas" providing implicit typing rules as defined in the YAML 1.2 specification (including support for user-defined custom schemas; see
Data.YAML.Schema).Support for emitting YAML using Failsafe, (strict) JSON, and (flexible) Core "schemas" (including support for user-defined custom encoding schemas; see
Data.YAML.Schema).Event-based API resembling LibYAML's Event-based API (see
Data.YAML.Event).Low-level API access to lexical token-based scanner (see
Data.YAML.Token).
See also the HsYAML-aeson package which allows to decode and encode YAML by leveraging aeson's FromJSON and ToJSON instances.
Changes
0.2.1.5
2025-03-11, Andreas Abel
- Drop support for old dependencies predating LTS 7.24 (GHC 8.0).
- Relax bound on
containers. - Tested with GHC 8.0 - 9.12.1.
0.2.1.4
2024-04-25, Andreas Abel
- Drop support for GHC 7.
- Testsuite: relax lower bounds to accommodate LTS 11.22 (GHC 8.2) for new Stack CI.
- Tested with GHC 8.0 - 9.10.0 (alpha3).
0.2.1.3
2023-10-14, Andreas Abel
- Pacify
x-partialwarning of GHC 9.8. - Tested with GHC 7.10 - 9.8.1.
0.2.1.2
2023-09-29, Andreas Abel
- Add
default-extensions: TypeOperatorsto silence warning under GHC ≥ 9.4. - Support latest versions of dependencies.
- Tested with GHC 7.10 - 9.8.0.
0.2.1.1
2022-05-11, Andreas Abel
- Compatibility with
mtl-2.3. - Tested with GHC 7.4 - 9.2.
0.2.1.0
2019-10-06, Herbert Valerio Riedel
- Define
Functor Docinstance (#33) - New
withScalarfunction and also defineToYAML ScalarandFromYAML Scalarinstances - Export
Pairtypesynonym fromData.YAML(#31) - New
Data.YAML.prettyPosWithSourcefunction for pretty-printing source locations (i.e.Posvalues) - Add export
docRoot :: Doc n -> nfield accessor for convenience (#32)
0.2.0.0
This release incorporates the work from Vijay Tadikamalla’s GSOC 2019 Project. Highlights of this major release include support for emitting YAML as well as providing direct access to source locations throughout the parsing pipeline for improved error reporting.
-
Changes in
Data.YAMLmodule- YAML 1.2 Schema encoders (#21)
- New
ToYAMLclass for encoding Haskell Data-types from which YAML nodes can be constructed (#20)- New functions like
encodeNode,encodeNode'for constructing AST - New functions like
encode,encode1,encodeStrict,encode1Strictfor supporting typeclass-based dumping - Some ToYAML instances and other api
- New functions like
- Modify
typeMismatchfunction to show error source location in error messages (#19) - Provide location-aware
failAtNodealternative tofail
-
Changes in
Data.YAML.Eventmodule- Preserve and round-trip Comments at Event level(#24)
- New
CommentEvent to preserve comments while parsing - Some additional implementations to preserve and round-trip comments
- New
- Fix issue #22
- New
EvPostype for recording event and their corresponding position (#19) - Preserve Flow Mapping and Flow sequence (#18)
- Features to preserve Literal/Folded ScalarStyle (#15)
- New
Chomptype denoting Block Chomping Indicator - New
IndentOfstype denoting Block Indentation Indicator
- New
- New
NodeStyletype denoting flow/block style Event(SequenceStart,MappingStart)constructors now recordNodeStyleStyletype renamed toScalarType- New
writeEventsandwriteEventsTextfunction Event(DocumentStart)now records YAML directive- Event parser now rejects duplicate/unsupported YAML/TAG directives as mandated by the YAML 1.2 specification
- Preserve and round-trip Comments at Event level(#24)
-
Move some schema related definitions from
Data.YAMLinto the newData.YAML.Schemamodule -
Make
decode,decode1,decodeStrict,decode1Strict,decodeNode, anddecodeNode'treat duplicate keys (under the respective YAML schema) in YAML mappings as a loader-error (controllable via newschemaResolverMappingDuplicatesschema property) -
Define
GenericandNFDatainstances for most types
0.1.1.3
- Fix bug in float regexp being too lax in the JSON and Core schema (#7)
- Remove dependency on
dlist
0.1.1.2
- Tolerate BOM at each
l-document-prefix(rather than only at the first one encountered in a YAML stream) - Workaround broken
mtl-2.2.2bundled in GHC 8.4.1 (#1) - Relax to GPL-2.0-or-later
0.1.1.1
- Reject (illegal) non-scalar code-points in UTF-32 streams
- Tolerate BOM at start of stream
- Disambiguate choice in
l-any-documentproduction regarding token separation ofc-directives-end - Fix
c-indentation-indicator(n)grammar production when auto-detecting indentation in the presence of empty leading lines; also reject (illegal) auto-indent-level scalars with leading more-indented all-space lines - Complete character escape rules for double-quoted scalars
- Minor optimizations
0.1.1.0
Data.YAMLmodule promoted fromTrustWorthytoSafe- Add
FromYAML Naturalinstance - Add
MonadFail,Alternative, andMonadPlusinstances forData.YAML.Parser - Add
Data.YAML.decodeStrictfunction - Export
Data.YAML.typeMismatchhelper function
0.1.0.0
- First version. Released on an unsuspecting world.