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

Make Ormolu print debug info about operator fixity inference #1097

Merged
merged 2 commits into from
Feb 15, 2024
Merged

Conversation

mrkkrp
Copy link
Member

@mrkkrp mrkkrp commented Feb 9, 2024

Close #1060, close #1069.

Copy link

github-actions bot commented Feb 9, 2024

@github-actions github-actions bot temporarily deployed to pull request February 9, 2024 15:26 Inactive
Copy link
Collaborator

@brandonchinn178 brandonchinn178 left a comment

Choose a reason for hiding this comment

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

My other PR also added troubleshooting docs to the README. Perhaps that would still be useful to add?

I'm still not a fan of manually passing Bools all the way down the stack. I also think it would be better if there were one way to log things, instead of some places using hPutStrLn stderr and some using trace.

@github-actions github-actions bot temporarily deployed to pull request February 9, 2024 16:53 Inactive
@@ -261,7 +261,7 @@ checkFixities dependencies fixityImports expectedResult =
where
actualResult =
fmap
(\(k, _) -> (k, inferFixity k resultMap))
(\(k, _) -> (k, inferFixity False k resultMap))
Copy link
Member

Choose a reason for hiding this comment

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

Call sites like this would make it nice if we used some dedicated type instead of Bool, eg

data DebugLogging = DebugLoggingEnabled | DebugLoggingDisabled

(unless this is too annoying, but I don't immediately see a big obstacle)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, but then in general it applies to pretty much any Bool and we have quite a few of them, see Config for example. Maybe a separate PR could be opened for this kind of refactoring.

Copy link
Member

Choose a reason for hiding this comment

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

Do you have an opinion whether choice might be worth it? I think it could be a nice as an alternative to our various "blind Bools" (and even some ad-hoc two-constructor types, like IsApplicand or ForAllVisibility).

Copy link
Member Author

Choose a reason for hiding this comment

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

choice looks nice!

@mrkkrp mrkkrp merged commit 6e5c77a into master Feb 15, 2024
10 checks passed
@mrkkrp mrkkrp deleted the issue-1060 branch February 15, 2024 16:13
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.

Make it easier to debug fixity issues
3 participants