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

ormolu backend for haskell-mode is broken #312

Closed
Eason0210 opened this issue Aug 3, 2024 · 2 comments · Fixed by #321
Closed

ormolu backend for haskell-mode is broken #312

Eason0210 opened this issue Aug 3, 2024 · 2 comments · Fixed by #321

Comments

@Eason0210
Copy link

Eason0210 commented Aug 3, 2024

Hi,

Because the default brittany for haskell-mode is unmaintained, and the repos recommand to use ormolu instead.

But the ormolu (version: ormolu 0.7.7.0) don't works with cabal project, will get below error message in *aphelia-ormolu-log* buffer:

$ ormolu

The --stdin-input-file option is necessary when using input
from stdin and accounting for .cabal files

Command failed with exit code 9.

my configs:

(setf (alist-get 'haskell-mode apheleia-mode-alist) 'ormolu)

with below config, will fix the issue.

(push '(ormolu . ("ormolu"
                    `("--stdin-input-file" ,buffer-file-name)))
        apheleia-formatters)

Expected this can be fixed in apheleia.

Maybe it is time to change the default backend for haskell-mode to ormolu instead of brittany?

@raxod502
Copy link
Member

Fair enough. If the maintainer of the original formatter recommends switching, then it seems logical for us to switch as well, to encourage best practices as determined by each language's community.

Let me see if I can add a test case that will prevent a regression like this, too... I've done some work on more robust formatter tests that can leverage an entire project directory.

@raxod502
Copy link
Member

Nevermind, no new tests needed, we just need to run the existing ones again from time to time. That might be a good idea, run the full formatter test suite on a monthly schedule or something and have a bot file an issue for ones that are failing.

image

raxod502 added a commit that referenced this issue Sep 22, 2024
Closes #312. The installation script was failing due to some Cabal
bullshit that I don't even want to know the reason for, probably
triggered by new package versions coming available, so I switched to
upstream binaries. Applied the suggested fix from #312 for a new
command-line option which has become required. Also set Ormolu as the
default Haskell formatter instead of Brittany because that is what the
Brittany dev recommends (see again #312).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants