dhall-lang / dhall-haskell

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

combine `let` bindings in `dhall format` #2530

Closed sellout closed 10 months ago

sellout commented 10 months ago

Code like

    let Traversable = ./../Traversable/Type
in  let Applicative = ./../Applicative/Type
in  let NonEmpty = ./Type
in  let List/Traversable = ./../List/traversable
in    ./../Traversable/fromTraverse …

currently gets formatted as

let Traversable = ./../Traversable/Type
in  let Applicative = ./../Applicative/Type
    in  let NonEmpty = ./Type
        in  let List/Traversable = ./../List/traversable
            in    ./../Traversable/fromTraverse …

but I think

let Traversable = ./../Traversable/Type
let Applicative = ./../Applicative/Type
let NonEmpty = ./Type
let List/Traversable = ./../List/traversable
in    ./../Traversable/fromTraverse …

would be semantically equivalent and much nicer?

This is largely a consequence of updating some older, pre multi-let, code. But I can see myself continuing to insert things like let x = y in without paying attention to there already being let bindings around, and being surprised when it indents the rest of the code.

sellout commented 10 months ago

Sorry, this is handled by dhall lint, not dhall format.