Skip to content

Conversation

nikita-volkov
Copy link

@nikita-volkov nikita-volkov commented Oct 10, 2025

Addresses the bug described in #1346.

Should be noted that the patch is generated with AI.

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
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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).

Copy link
Author

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) $
Copy link
Contributor

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.

Copy link
Author

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

Copy link
Contributor

@Bodigrim Bodigrim Oct 12, 2025

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)

Copy link
Author

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)
@ysangkok
Copy link
Member

Have you tested this with puresat? Or do you want me to test it?

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.

4 participants