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

Can't access __HADDOCK_VERSION__ #10818

Open
LeventErkok opened this issue Mar 6, 2025 · 3 comments
Open

Can't access __HADDOCK_VERSION__ #10818

LeventErkok opened this issue Mar 6, 2025 · 3 comments

Comments

@LeventErkok
Copy link

LeventErkok commented Mar 6, 2025

Following the discussion in #9177

@FinleyMcIlwaine I want to have access to __HADDOCK_VERSION__; alas, using the mechanism described in #9177 doesn't seem to work.

To be specific, I created a project.cabal file, with contents:

packages: .

package *
  documentation: true
  haddock-version-cpp: True

but this doesn't seem to make __HADDOCK_VERSION__ defined as a macro in source files. Any advice?

@FinleyMcIlwaine
Copy link
Contributor

Hi @LeventErkok. The discussion in that PR is long and it looks like my original PR description became stale as the patch progressed. Based on this comment by @alt-romes it looks like the haddock-version-cpp option was never introduced and the decision was made to remove the __HADDOCK_VERSION__ macro altogether. Apologies for the inconvenience. What is your use-case for the macro?

@LeventErkok
Copy link
Author

For my particular case, I'd like to hide doc-test setup segments from generated Haddock output. Without having a way to tell whether we're running under haddock or not, this is impossible to do.

Based on clash-lang/clash-compiler#2902, I think Clash has similar needs. @DigitalBrains1 might want to comment further.

At the end of the day, it seems like it'd be useful to have a mechanism for users to determine if haddock is the starting point. I understand the motivation for avoiding rebuilds, but if the user chooses to do so, there should be a way; to maintain old behavior if nothing else.

@mpickering
Copy link
Collaborator

I think the proper mechanism to fix this would be to make "haddock" into a way (the same as static, dynamic etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants