dhall format: Canonicalize and Check Dhall
dhall format rewrites Dhall source into canonical form, and dhall format --check fails if a file is not already formatted.
Formatting Dhall in CI keeps generated config diffs meaningful and catches unparseable source before the compile step.
What it does
dhall format parses a Dhall expression and prints it in canonical layout. --inplace rewrites the file; --check does not write but exits non-zero if the file would change. dhall lint is the related command that removes dead code and updates deprecated syntax.
Common usage
# rewrite in place
dhall format --inplace config.dhall
# CI gate: non-zero if not already formatted
dhall format --check config.dhall
# also remove dead let-bindings and modernize syntax
dhall lint config.dhallOptions
| Flag | What it does |
|---|---|
| --check | Exit non-zero if the file is not already formatted |
| --inplace <path> | Rewrite the file in place |
| (stdin) | With no --inplace, read stdin and print formatted output |
| dhall lint | Related: remove dead code, update deprecated imports |
In CI
Run dhall format --check before dhall-to-yaml/json so a syntactically broken or unformatted file fails fast and cheaply. Pin the dhall version; the canonical format has changed across language releases, so an unpinned formatter can fail --check on untouched files.
Common errors in CI
With --check, a non-zero exit means the file is not canonically formatted; run dhall format --inplace to fix. "Error: Invalid input" with a parse location means the source does not parse and cannot be formatted; fix the syntax. If --check fails only after a runner image update, the dhall version likely changed the canonical format.