Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fourmolu hook does not read the cabal files for default-extensions #171

Open
lf- opened this issue Oct 3, 2022 · 4 comments
Open

Fourmolu hook does not read the cabal files for default-extensions #171

lf- opened this issue Oct 3, 2022 · 4 comments

Comments

@lf-
Copy link

lf- commented Oct 3, 2022

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 60cad1a

@domenkozar
Copy link
Member

There's an example in the README, did you follow that?

@zmrocze
Copy link

zmrocze commented May 7, 2023

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?

@zmrocze
Copy link

zmrocze commented May 7, 2023

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

@zmrocze
Copy link

zmrocze commented May 7, 2023

From CHANGELOG it looks like the support for this extensions lands in version 5, while nixpkgs.haskellPackages.fourmolu is 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants