dhall-to-yaml: Compile Dhall Config to YAML
dhall-to-yaml evaluates a Dhall expression and emits the equivalent YAML, with full type checking before any output.
Dhall is a typed, non-Turing-complete config language. Its compiler rejects ill-typed config before it ever reaches your cluster, which is the whole point of using it in CI.
What it does
dhall-to-yaml reads a Dhall expression (from a file or stdin), type-checks and normalizes it, then serializes the result as YAML. dhall-to-json is the JSON counterpart. Because Dhall is typed, a schema mismatch is a compile error, not a bad manifest.
Common usage
dhall-to-yaml --file config.dhall --output config.yaml
# from stdin
cat config.dhall | dhall-to-yaml > config.yaml
# a package expression with a record of many documents
dhall-to-yaml --documents --file ./k8s.dhall > all.yamlOptions
| Flag | What it does |
|---|---|
| --file <path> | Read the Dhall expression from a file |
| --output <path> | Write YAML to a file instead of stdout |
| --documents | Emit a multi-document YAML stream from a list |
| --explain | Print a detailed explanation for type errors |
| --quoted | Quote all YAML strings |
In CI
Dhall imports can fetch remote expressions over HTTP; pin them with an integrity hash (sha256:...) so a supply-chain change fails the build instead of silently rendering different config. Run with --explain in CI logs so a type error is actionable. Cache the ~/.cache/dhall directory to speed repeated runs.
Common errors in CI
"Error: Expression doesn't match annotation" with a - Expected: / + Actual: type diff is the core Dhall type error: your value does not match the declared schema. "Error: Wrong type of function argument" means you applied a function to a mismatched type. "Error: Import integrity check failed" means a pinned sha256: hash no longer matches the fetched import; do not blindly re-freeze in CI.