Skip to content

Feature request: enable --enable-documentation by default #7462

Closed

Description

@Bodigrim

Most of the time when users invoke cabal haddock, they meant to run cabal haddock --enable-documentation (to generate hyperlinks to entities from other packages). Any reason this is not a default behaviour? AFAIU this flag does not affect build plan.

Activity

  1. Mikolaj commented on Jun 28, 2021

    @Mikolaj
    Member

    I don't see this flag in

    cabal v2-haddock --builddir="$dir" --haddock-for-hackage --enable-doc
    

    which is what the unfortunate users that depend on libraries not present on Hackage servers need to invoke to build documentation and upload it manually: https://hackage.haskell.org/upload

    However, perhaps --haddock-for-hackage could override --enable-documentation. Or does it imply it? Because it definitely generates hyperlinks.

    Are there any other popular uses?

  2. andreasabel commented on May 1, 2022

    @andreasabel
    Member

    @Mikolaj: In your command, is --enable-doc something different than --enable-documentation ?
    (Confused.)
    I am not usually passing --enable-doc with --haddock-for-hackage, is this a mistake?

    Anyhow, I think having to pass --enable-documentation to cabal v2-haddock is as unexpected (and seemingly paradoxical) than having to pass --enable-tests to cabal v2-test.

  3. Mikolaj commented on May 2, 2022

    @Mikolaj
    Member

    @Mikolaj: In your command, is --enable-doc something different than --enable-documentation ? (Confused.)

    I've just copied it from https://hackage.haskell.org/upload. It works, because any non-ambiguous prefix of a command works.

    I am not usually passing --enable-doc with --haddock-for-hackage, is this a mistake?

    Anyhow, I think having to pass --enable-documentation to cabal v2-haddock is as unexpected (and seemingly paradoxical) than having to pass --enable-tests to cabal v2-test.

    I agree. Frankly, I haven't tested if this is required (assuming you don't have docs enabled in any of the configs). I just copy-pasted it. If it's not required in the current stable cabal, let's fix the snippet at https://hackage.haskell.org/upload.

  4. Bodigrim commented on Jun 16, 2022

    @Bodigrim
    CollaboratorAuthor

    @Mikolaj what kind of additional info is needed here?

  5. Mikolaj commented on Jun 17, 2022

    @Mikolaj
    Member

    No more info is needed. I forgot to remove the label after I found out that --enable-doc is equal to --enable-documentation.

    If nobody objects, let's make --enable-documentation the default in cabal haddock. That probably introduces the complexity that different commands have different defaults for the same option, but human expectations are sometimes not towards the simplest setup and UI should strive towards least surprise.

  6. fgaz commented on Jun 18, 2022

    @fgaz
    Member

    Wasn't there a similar situation for --enable-tests? Can anyone find the ticket?
    edit: nevermind, this is different since docs don't affect the build plan

  7. ulysses4ever commented on Jun 18, 2022

    @ulysses4ever
    Collaborator

    @fgaz that would be #5079

  8. ulysses4ever commented on Jun 18, 2022

    @ulysses4ever
    Collaborator

    As pointed there, enable-tests do actually affect the build plan, unlike (according to OP) enable-documentation. So the current issue is a clearer cut.

  9. self-assigned this
    on Jul 1, 2022
  10. linked a pull request that will close this issuecabal haddock imply enable-documentation #8259on Jul 4, 2022
  11. added
    re: enable-documentation
    on Jul 28, 2022
  12. andreasabel commented on Jul 28, 2022

    @andreasabel
    Member

    This new feature is giving me a lot of trouble in connection with

    This is because --enable-documentation triggers the assertion reported in #8313. Typically, it looks like:

    $ cabal haddock -w ghc-8.10.7
    Warning: this is a debug build of cabal-install with assertions enabled.
    Resolving dependencies...
    Build profile: -w ghc-8.10.7 -O0
    In order, the following will be built (use -v for more details):
     - clock-0.8.3 (lib) (requires build)
     - colour-2.3.6 (lib) (requires build)
    Assertion failed
    CallStack (from HasCallStack):
      assert, called at src/Distribution/Client/ProjectPlanning.hs:246:5 in cabal-install-3.9.0.0-inplace:Distribution.Client.ProjectPlanning
    

    Also, --disable-documentation is ignored (that's a bug), so there is no workaround:

    $ cabal haddock -w ghc-8.10.7 --disable-documentation
    Warning: this is a debug build of cabal-install with assertions enabled.
    Build profile: -w ghc-8.10.7 -O0
    In order, the following will be built (use -v for more details):
     - clock-0.8.3 (lib) (requires build)
     - colour-2.3.6 (lib) (requires build)
    Assertion failed
    CallStack (from HasCallStack):
      assert, called at src/Distribution/Client/ProjectPlanning.hs:246:5 in cabal-install-3.9.0.0-inplace:Distribution.Client.ProjectPlanning
    
  13. ulysses4ever commented on Jul 29, 2022

    @ulysses4ever
    Collaborator

    @andreasabel good news: the patch is easy. Bad news: I fail to test it. Details are in #8330. Really hope for someone's help!

  14. Bodigrim commented on Jan 13, 2025

    @Bodigrim
    CollaboratorAuthor

    All referenced issues / PRs are closed; closing this as well.

  15. andreasabel commented on Jan 18, 2025

    @andreasabel
    Member

    Yes, we shot ourselves in the foot by implementing this feature:

    I regret having made this comment (which was out of my ignorance):

    Anyhow, I think having to pass --enable-documentation to cabal v2-haddock is as unexpected (and seemingly paradoxical)

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions