Difference between `dhall format` and `dhall lint`
Asked Answered
O

1

5

Playing with dhall for the first time I saw that it supports these two options:

  ./dhall --help
  ...
  lint                     Improve Dhall code
  format                   Formatter for the Dhall language

What's the difference between the two? From running them on my sample project it appears they to the same thing. I'd have expected the linter to go further than formatting in some ways (e.g. recommending "idiomatic" dhall) but couldn't find any info on it.

Ought answered 7/1, 2019 at 15:23 Comment(0)
S
6

The improvements dhall lint does (at the time of this writing) are listed here and currently consist of:

  • removing unused let bindings
  • consolidating nested let bindings to use a multiple-let binding
  • switching legacy List-like Optional literals to use Some / None instead
  • removing the constructors keyword

Generally, you should expect the dhall lint improvements to fall into one of two categories:

  • Non-controversial improvements to the code

    ... such as the first improvement to remove unused let bindings

  • Automatic code migrations to help users stay current with newer language features

    ... such as the last three improvements

Spratt answered 7/1, 2019 at 18:55 Comment(3)
Thanks! The hackage link could be just a little more discoverable from the dhall-lang website, it has great info ;-)Ought
@JohannesRudolph: I added this to the FAQ: github.com/dhall-lang/dhall-lang/wiki/…Spratt
The FAQ has now moved to: docs.dhall-lang.org/howtos/…Spratt

© 2022 - 2024 — McMap. All rights reserved.