-
Notifications
You must be signed in to change notification settings - Fork 206
Fix: Filter out private internal libraries from package pages #1437
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: nikita-volkov <[email protected]>
Co-authored-by: nikita-volkov <[email protected]>
…-visibility Fix: Filter out private internal libraries from package pages
in (libName lib, ModSigIndex { modIndex = mod_ix, sigIndex = sig_ix }) | ||
where | ||
-- Only show main library or internal libraries with public visibility | ||
isPublicLibrary lib = libName lib == LMainLibName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it insufficient to check only libVisibility
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know but this solution seems safe even if it is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cabal does not allow visibility: private
for the main library, so I think checking just libVisibility
is enough (and more idiomatic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Addressed.
|
||
allCondLibs :: GenericPackageDescription -> [(LibraryName, CondTree ConfVar [Dependency] Library)] | ||
allCondLibs desc = maybeToList ((LMainLibName,) <$> condLibrary desc) | ||
allCondLibs desc = filter (isPublicCondLib . snd) $ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the function responsible for contents on pages like https://hackage.haskell.org/package/tar-0.7.0.0/dependencies? If yes then I think it should continue showing all sublibraries, even internal ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only place where allCondLibs
is used is
, rendLibraryDeps = second (depTree libBuildInfo) <$> allCondLibs genDesc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, which suggests to me that this function is to list package dependencies. I don't think we want to hide package dependencies of internal libraries, it would be quite misleading for readers. (I'm not a maintainer here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I've removed those changes.
visibility can be a part of CondTree, e. g., ```haskell library foo-internal if flag(foo) visibility: public else visibility: private ``` See haskell#1437 (comment)
Have you tested this with puresat? Or do you want me to test it? |
Addresses the bug described in #1346.
Should be noted that the patch is generated with AI.