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

Use Hackage fixities in Fourmolu CLI mode #3454

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

georgefst
Copy link
Collaborator

@georgefst georgefst commented Jan 17, 2023

See #3421.

Could do with a test.

(EDIT: I've forgotten exactly how this relates to #3165...)

(EDIT: I'm also now confused as to why I wanted to pass --no-cabal in the first place in #2950 (sub-EDIT ah, probably just performance). We should also look at #3449 and #3771 and see whether Ormolu has similar issues.)

getUnit = \case
ExposePackage _ (UnitIdArg (RealUnit (Definite (UnitId s)))) _ -> Just s
_ -> Nothing
drop' n xs = drop (n `min` (Prelude.length xs - 1)) xs
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a horrible hack, but I don't have any better ideas. I wouldn't be surprised if there's no clean way to go from GHC package-id strings to Hackage library names.

@wz1000
Copy link
Collaborator

wz1000 commented Feb 7, 2023

Can we somehow instead pass the actual accurate fixities that GHC computes for the file to fourmolu? It seems strange to rely on hacks when in HLS we know the actual fixities for everything as soon as a file compiles.

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

Successfully merging this pull request may close these issues.

None yet

2 participants