You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if, instead of having to specify files to format via a directory or a complicated call to git, fourmolu would simply detect the files to format in the same way cabal does. Basically, if the command cabal build all --enable-tests --enable-benchmarks would read a particular Haskell source file, then fourmolu -i should format that file.
Why the current situation is not good enough
For any particular project, I can somehow adapt the fourmolu call. But when I want to automatize (e.g. to write a good git alias, or a github action), I want to be able to deal with any sort of Haskell repo.
Specifying a directory
The docs recommend e.g. fourmolu -i src. This doesn't work for projects that have several folders (e.g. test, benchmark, app) generically because a project might have any sort of folders. Also, it doesn't work when you have a cabal.project structure.
git ls-files
The docs recommend fourmolu --mode inplace $(git ls-files '*.hs'), but this doesn't work in general because there might be other files like *.lhs, *.md. Also, it doesn't work if there is no git repository (e.g. downloading a tarball).
What would be the most straightforward way
Like cabal, fourmolu should automatically discover whether there is a *.cabal file, and then format all of the Haskell source files specified in it, or if there is a cabal.project file, format all the source files found from all the cabal projects in there. Advantages:
Single point of definition what is part of the project and what is not
No additional assumptions about directory structure or available tooling
The text was updated successfully, but these errors were encountered:
This would be great, perhaps behind an --all-files flag! Can you file an issue with ormolu? It would be great if this could be implemented in ormolu and we'd get it for free after. If ormolu rejects it, we can implement it ourselves
It would be great if, instead of having to specify files to format via a directory or a complicated call to
git
,fourmolu
would simply detect the files to format in the same waycabal
does. Basically, if the commandcabal build all --enable-tests --enable-benchmarks
would read a particular Haskell source file, thenfourmolu -i
should format that file.Why the current situation is not good enough
For any particular project, I can somehow adapt the
fourmolu
call. But when I want to automatize (e.g. to write a goodgit
alias, or a github action), I want to be able to deal with any sort of Haskell repo.Specifying a directory
The docs recommend e.g.
fourmolu -i src
. This doesn't work for projects that have several folders (e.g.test
,benchmark
,app
) generically because a project might have any sort of folders. Also, it doesn't work when you have acabal.project
structure.git ls-files
The docs recommend
fourmolu --mode inplace $(git ls-files '*.hs')
, but this doesn't work in general because there might be other files like*.lhs
,*.md
. Also, it doesn't work if there is no git repository (e.g. downloading a tarball).What would be the most straightforward way
Like
cabal
, fourmolu should automatically discover whether there is a*.cabal
file, and then format all of the Haskell source files specified in it, or if there is acabal.project
file, format all the source files found from all the cabal projects in there. Advantages:The text was updated successfully, but these errors were encountered: