$ show dhall-lang/dhall-haskell
This is the canonical Haskell implementation of the Dhall programmable configuration language, organized as a monorepo. It provides a complete toolchain: a core library for parsing, type-checking, normalization, and import resolution; CLI executables for formatting, linting, freezing, and converting between Dhall and JSON/YAML/CSV/TOML/Nix/Bash; an LSP server for IDE integration; and a documentation generator. The architecture is modular with separate Cabal packages for each conversion backend and developer tool, all sharing the core dhall library. In production, it is used to generate and validate configuration files for systems like Kubernetes, CI pipelines, and Nix packages, ensuring type safety and reproducibility via content-addressed imports and semantic caching.
The LLM identified 3 files worth highlighting for reuse:
An order-preserving map backed by Data.Map and Data.Sequence. Maintains insertion order for record fields and union constructors, essential for deterministic formatting. Exposes a full Map API (lookup, insert, union, traverse, etc.) and is used pervasively across the Dhall AST. Could be extracted and reused in any Haskell project needing a map with insertion-order iteration.
An order-preserving set built on Data.Set and a companion sequence. Used to retain insertion order when formatting union types and record type fields. Provides standard set operations while guaranteeing stable ordering. Reusable in any context where set semantics and insertion order are both required.
Provides the FromDhall typeclass with generic derivation via GHC.Generics, plus composable RecordDecoder (applicative) and UnionDecoder (monoid) for decoding Dhall expressions into Haskell values. Supports custom options for constructor/field naming, singleton constructors, and input normalization. This pattern is directly reusable for any Haskell library that needs to deserialize a configuration language into user-defined types.