Open codygman opened 1 year ago
That doesn't sound too unreasonable.
Some reservations I would have are:
hpack
on any package.yaml
files you find. I'm not sure what sort of problems you'd encounter with this, but it'd be really nice to have some tests that this is actually working as promised..cabal
files is now seen as good practice: https://www.fpcomplete.com/blog/storing-generated-cabal-files/. This feature wouldn't be necessary if you committed cabal files.hpack
. That way, you could pair that hpack-action
with either this repo or the ormolu GitHub Action. Or any other Haskell-related GitHub Action that requires .cabal
files to be present.IMHO, this is an upstream problem. Fourmolu should just support hpack/package.yaml. It could even run hpack in memory and then use the exact cabal file logic.
Oh, also, this fourmolu-action
should currently be working even if you don't check-in the .cabal
files.
In our repo at work, we don't check in .cabal
files and this action still works for us. fourmolu
will still output a line like:
Could not find a .cabal file for /home/runner/work/our-org/our-repo/package-foo/src/FooBar.hs
But fourmolu still runs on this file and correctly checks the formatting, although it is not able to figure out default language extensions or fixities for dependencies' operators: https://github.com/fourmolu/fourmolu#language-extensions-dependencies-and-fixities
IMHO, this is an upstream problem. Fourmolu should just support hpack/package.yaml. It could even run hpack in memory and then use the exact cabal file logic.
I don't think Fourmolu (or Ormolu) should be responsible for generating cabal files. If you're using stack, why not run a short stack path
(or some other trivial stack command to run hpack) before running the action? It seems like a lot of overhead for Fourmolu (e.g. adding hpack as a dependency) when there's such a simple workaround before
Otherwise the cabal files aren't there.