Skip to content

Use Hackage fixities in Fourmolu CLI mode - #3454

Draft
georgefst wants to merge 1 commit into
masterfrom
fourmolu-fixity-packages
Draft

Use Hackage fixities in Fourmolu CLI mode#3454
georgefst wants to merge 1 commit into
masterfrom
fourmolu-fixity-packages

Conversation

@georgefst

@georgefst georgefst commented Jan 17, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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

wz1000 commented Feb 7, 2023

Copy link
Copy Markdown
Collaborator

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.

2 participants