I’d like to propose creating a $100 feature bounty for a new contributor to implement the following Prelude utility:

-- ./Prelude/JSON/renderYAML : JSON → Text

In other words, this would render a value of type JSON as the corresponding YAML string, using Text/show for rendering YAML strings (for simplicity; no multi-line rendering necessary).

My selfish motivation for proposing this is that I’m currently implementing a dhall-kubernetes-charts repository to replace Helm with Dhall and this would benefit the repository in a few ways:

It would allow me to implement the entire repository logic in pure Dhall, including rendering the Kubernetes resources as YAML

I would like to write certain test assertions to compare against a rendered YAML string instead of comparing against the equivalent Dhall value

The reason why is that the Dhall value representing a Kubernetes resource might be enormous (with a lot of None field), whereas the corresponding rendered YAML value (with nulls filtered out) will be much more compact.

However, I assume this would also benefit other people, too, since this could eventually replace the dhall-to-yaml utility in some cases.

I can implement this utility myself but part of the reason for proposing this bounty is to begin creating a few representative expenses that potential donors can refer to as an example of how their donations could be used. I would also like to use these sorts of bounties to grow the pool of contributors to the Dhall ecosystem.

I am asking because I was wondering if the renderYAML function could be modified to render comments and sort the keys (e.g. using special record keys such as yamlComment and yamlOrder, similarly to mapKey/mapValue) to produce a prettier output.

Alright. Then is there existing examples that uses the renderYAML function? For example you mentioned it could be used to render the Kubernetes resources and facilitate test assertions, is this going to use or need an extra convertion procedure?

@tristanC: Currently there aren’t any examples outside the tests for the renderYAML function. My plan is to use this function to render Kubernetes resources by auto-generating a family of */toJSON functions for each resource type