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

code-generators documentation is unclear about which GHC options are passed #9238

Open
mpickering opened this issue Sep 6, 2023 · 2 comments
Labels
documentation re: code-generators Concerning the `code-generators` field/functionality for `testsuite`s

Comments

@mpickering
Copy link
Collaborator

The code-generators documentation is a bit unclear about which component the options passed to the generation executable are intended to compile.

I performed some investigation and the GHC options which are passed to the code generator are actually the options you need to build the test executable rather than any of the library components.

Therefore I think this limits the utility of this feature as it can't work unless there is a lucky alignment that the same options work for your doctests as would work for your test executable. One case I tried which failed was adding ghc-options: -XRoleAnnotations to the library stanza, which caused the doctest to fail with:

src/MyLib.hs:16:1: error:
    • Illegal role annotation for A;
      did you intend to use RoleAnnotations?
    • while checking a role annotation for ‘A’

This is in contrast to the previous cabal-docspec approach which generated a file which contained the options which were used to build the package.

@Mikolaj Mikolaj added the re: code-generators Concerning the `code-generators` field/functionality for `testsuite`s label Sep 6, 2023
@Mikolaj
Copy link
Member

Mikolaj commented Sep 6, 2023

Pinging @gbaz, since this looks like a useful feedback for the new and promising code generators feature.

@gbaz
Copy link
Collaborator

gbaz commented Sep 11, 2023

I'd definitely welcome a patch to the documentation to specify this.

Of a mixed mind if we'd want to change the behavior or not -- grabbing options or other settings from a different stanza could be weird (and possibly tricky to implement just from how the code is structured). We could suggest common stanzas or the like as a way to make this easy to do, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation re: code-generators Concerning the `code-generators` field/functionality for `testsuite`s
Projects
None yet
Development

No branches or pull requests

3 participants