# \[RFC\] yamlet: a YAML 1.2 library

**URL:** <https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795>\
**Category:** Show and Tell\
**Created:** [October 4, 2026, 7:16am UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795 "2026-10-04T07:16:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arybczak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/arybczak/32/2527_2.png) [@arybczak](https://discourse.haskell.org/u/arybczak)\
**Post date:** [October 4, 2026, 7:16am UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/1 "2026-10-04T07:16:36Z")

</div>

I’ve been stress-testing Claude Opus 5.5 and thought a YAML library with a good API would fill a hole in the ecosystem. The result:

- Repo: [GitHub - arybczak/yamlet · GitHub](https://github.com/arybczak/yamlet)
- Package candidate: [yamlet: A pure, fast and conforming YAML 1.2 library.](https://hackage.haskell.org/package/yamlet-1.0.0.0/candidate)

In short, yamlet is a YAML 1.2 library with fast encoding/decoding, preservation of structure (including comments where you want them) and support for generic deriving that compiles to good code for common shapes of data types.

If anyone was doing YAML processing in Haskell and found it lacking, have a look at the API. It was good enough for me to make [haskell-gha](https://github.com/arybczak/haskell-gha) without any workarounds, but if I missed something, I’d like to know before the first release.

Documentation is mostly Claude-generated, so expect an odd wording here and there, but there’s also plenty of doctests.

---

<div class="post-metadata">

**Author:** ![andremarianiello](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/andremarianiello/32/4870_2.png) [@andremarianiello](https://discourse.haskell.org/u/andremarianiello)\
**Post date:** [October 4, 2026, 1:49pm UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/2 "2026-10-04T13:49:03Z")

</div>

What was the motivation for a new yaml library? I assume something about the current libraries isn’t good enough?

---

<div class="post-metadata">

**Author:** ![dawkrish](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/dawkrish/32/4746_2.png) [@dawkrish](https://discourse.haskell.org/u/dawkrish)\
**Post date:** [October 4, 2026, 2:34pm UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/3 "2026-10-04T14:34:07Z")

</div>

You didn’t use pre-existing parser libraries ? wrote the parser from scratch?

---

<div class="post-metadata">

**Author:** ![arybczak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/arybczak/32/2527_2.png) [@arybczak](https://discourse.haskell.org/u/arybczak)\
**Post date:** [October 5, 2026, 7:15pm UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/4 "2026-10-05T19:15:15Z")

</div>

> [@andremarianiello](#):
>
> I assume something about the current libraries isn’t good enough?

Yes, otherwise I would just use an existing one 😉

- yaml doesn’t support comments at all, HsYAML keeps them only in its event API.
- Both drop the order of keys in a mapping in their high level API. You need to drop down to their event APIs to get it, which are low level and cumbersome to use.
- HsYAML’s parser is _very_ slow (see benchmarks in README). Both pandoc ([#6084](https://github.com/jgm/pandoc/issues/6084)) and ghcup ([#270](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/270)) switched to it and later back to libyaml because of that.
- yaml goes through aeson’s Value, which leaks its quirks into YAML processing (e.g. infinities become strings +inf/-inf instead of a proper YAML .inf float) and emits JSON-specific paths in error messages without line numbers.

> [@dawkrish](#):
>
> You didn’t use pre-existing parser libraries ? wrote the parser from scratch?

Yes, it’s the same thing `aeson` does since 2.2. Parser libraries sacrifice either performance or error message quality, I wanted the library to have both. yamlet’s `P` is essentially a parser monad from `flatparse` holding YAML specific context with additional position tracking for better error messages.

---

<div class="post-metadata">

**Author:** ![andremarianiello](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/andremarianiello/32/4870_2.png) [@andremarianiello](https://discourse.haskell.org/u/andremarianiello)\
**Post date:** [October 5, 2026, 8:31pm UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/5 "2026-10-05T20:31:47Z")

</div>

Is there a way to use encode/decode using autodocodec codecs?

---

<div class="post-metadata">

**Author:** ![arybczak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/arybczak/32/2527_2.png) [@arybczak](https://discourse.haskell.org/u/arybczak)\
**Post date:** [October 5, 2026, 9:26pm UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/6 "2026-10-05T21:26:15Z")

</div>

I’m not familiar with autodocodec, but from a quick look it should be fine, just someone would need to provide the autodocodec-yamlet package.

---

<div class="post-metadata">

**Author:** ![arybczak](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/arybczak/32/2527_2.png) [@arybczak](https://discourse.haskell.org/u/arybczak)\
**Post date:** [October 11, 2026, 8:54am UTC](https://discourse.haskell.org/t/rfc-yamlet-a-yaml-1-2-library/14795/7 "2026-10-11T08:54:35Z")

</div>

[yamlet-1.0.0.0](https://hackage.haskell.org/package/yamlet) and [yamlet-aeson-1.0.0.0](https://hackage.haskell.org/package/yamlet-aeson) (a bridge for decoding and encoding YAML with aeson’s instances) are now on Hackage 🙂
