git-hooks.nix
git-hooks.nix copied to clipboard
Fourmolu hook does not read the cabal files for default-extensions
I have to set ormolu.defaultExtensions in flake.nix to use ImportQualifiedPost in my files, even though invoking Fourmolu manually does not require such since it reads the Cabal files.
This seems like pre-commit-hooks.nix is doing something funny that is causing fourmolu to not be able to read these.
commit 60cad1a326df17a8c6cf2bb23436609fdd83024e
There's an example in the README, did you follow that?
pre-commit = {
settings = {
hooks = {
fourmolu.enable = true;
};
settings.ormolu.cabalDefaultExtensions = true;
};
};
};
I have this pre-commit config and OverloadedRecordDot in default-extensions in .cabal.
But fourmolu formats a.b into a . b.
I don't get it: is the ormolu setting supposed to influence fourmolu? What's the status of this issue? Fixed with this trick above, but strangely doesn't work for some other reason on my side? Fourmolu doesn't support this? Or pre-commit doesn't?
From my experience fourmolu when run from pre-commit.nix:
- doesn't understand cabal's default extensions
- neither does it support
OverloadedRecordDot
because setting the OverloadedRecordDot option directly in the source file results in a fail:
The GHC parser (in Haddock mode) failed:
Unsupported extension: OverloadedRecordDot
but setting it just in cabal, doesn't fail, but formats the source not respecting the option
From CHANGELOG it looks like the support for this extensions lands in version 5, while nixpkgs.haskellPackages.fourmolu is 4.