dhall-lang / dhall-haskell

Maintainable configuration files
https://dhall-lang.org/
BSD 3-Clause "New" or "Revised" License
912 stars 213 forks source link

Split Dhall.Syntax #2449

Closed mmhat closed 2 years ago

mmhat commented 2 years ago

This PR splits Dhall.Syntax into several smaller modules to mitigate the effect of https://gitlab.haskell.org/ghc/ghc/-/issues/5642 and https://gitlab.haskell.org/ghc/ghc/-/issues/5642 - namely the excessive space usage at built time caused by the Generic instance of Dhall.Syntax.Expr. Most datatypes from Dhall.Syntax were moved to own modules in the Dhall.Syntax namespace and the derivation/declaration of type class instances for the datatypes were grouped in modules below Dhall.Syntax.Instances. Everything from the new modules gets re-exported by Dhall.Syntax and are internal to the dhall package; Nothing should change from a users point of view. The memory consumed during a run of cabal build dhall drops from ~1200 MB to ~800 MB and the build time decreases slightly.

I also removed the superfluous PreferFromWith data constructor which simplifies the PreferAnnotation type. Note that this is a breaking change.

Fixes #2313