Closed abailly closed 1 month ago
Strange, here's me doing the same commands:
$ stylish-haskell --version
stylish-haskell 0.14.5.0
$ stylish-haskell -v -i src/Statistics.hs
./coverage-guided-pbt/.stylish-haskell.yaml exists
Loading configuration at ./coverage-guided-pbt/.stylish-haskell.yaml
Parsing ./coverage-guided-pbt/coverage-guided-pbt.cabal...
Gathered default-extensions: []
Enabled Imports (ghc-lib-parser) step
Enabled LanguagePragmas step
Enabled Cases step
Enabled TrailingWhitespace step
Extra language extensions: []
Exit code behavior: normal
$ git diff src/Statistics.hs
# No changes
I can't imagine the minor version difference to be the problem (the CHANGELOG doesn't mention anything suspicious).
I assume you haven't changed coverage-guided-pbt/.stylish-haskell.yaml
?
While your output clearly says that it's reading the above config file, the docs say that stylish-haskell
looks for configs in other directories. Maybe double check that those somehow are not overriding the local one somehow (even though they shouldn't according to the docs)?
When I checked out the file afresh, then running same commands does not produce any difference. It seems I had another formatter in place (fourmolu) and then stylish-haskell did not reformat the code.
% git co src/Statistics.hs
% fourmolu -I src/Statistics.hs
% git diff --stat src/Statistics.hs
src/Statistics.hs | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
% stylish-haskell -i src/Statistics.hs
arnaud@mac-mini-2 coverage-guided-pbt % git diff --stat src/Statistics.hs
src/Statistics.hs | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
That's why I ditched stylish-haskell: I like my formatters to just format in a "canonical" way the code so that I don't have to think about it anymore :)
On a side note: The code requires GHC 9.10.1 (through base >= 4.20
) but there's no stylish-haskell
plugin for HLS on this GHC version 🤷
cabal init
inserted that constraint, I've just loosened it.
I am trying to play with the code and possibly suggest changes, but I am facing a very basic issue which is annoying: Although I configured my editor (Emacs + eglot) to use stylish-haskell, I am seeing differences when formatting an otherwise unchanged source file:
What am I doing wrong?
I am not using nix.