Ticket #3870 (new feature request)

Opened 2 years ago

Last modified 4 months ago

Avoid Haddock-links to the Prelude

Reported by: waern Owned by:
Priority: low Milestone: 7.4.1
Component: Documentation Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Documentation bug Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

If you're generating documenatation that links to the base package, you will see that some links to standard types go to the Prelude and some to the hierarchical libararies. For example, Int goes to Prelude.Int, while Either goes to Data.Either.Either.

This happens because the Prelude imports some types from the hierarchical libraries, while some are imported directly from internal GHC modules (e.g. GHC.Base). In the first case, the hierarchical module is choosen as the best place to link to since it's closer than the Prelude in the topological sort to the original module. In the latter case, the hierarchical module and the Prelude are of equal number of imports away from the original module, so none is considered a better place to link to. In this case one of the modules is arbitrarily chosen and it happens to be the Prelude.

I think it would be nice if the links would always go to the hierarchical libraries. Maybe the best way to achieve that would be to add {-# OPTIONS_HADDOCK NotHome #-} to the Prelude. This flag is not yet documented (I should get around to that). It tells Haddock to prefer linking to another module if one is available.

Change History

follow-up: ↓ 2   Changed 2 years ago by ross

  • type changed from bug to feature request

Isn't the reason Prelude.Int is chosen that GHC.Base is hidden, because it isn't part of the public interface of the package?

in reply to: ↑ 1   Changed 2 years ago by waern

Replying to ross:

Isn't the reason Prelude.Int is chosen that GHC.Base is hidden, because it isn't part of the public interface of the package?

GHC.Base is not chosen because it is hidden, but that leaves the choice to either Prelude.Int or Data.Int. Haddock prefers the module that is closest to the original module in the dependency tree. Since both Prelude.Int and Data.Int directly imports GHC.Base, they are at the same level of the dependency tree and thus Haddock has to make an arbitrary choice. If Prelude had imported Data.Int and not GHC.Base (just for illustration; such a restructuring may be hard to do since Prelude imports many more things via GHC.Base), the link would go to Data.Int.

  Changed 2 years ago by igloo

  • milestone set to 6.12 branch

  Changed 22 months ago by igloo

  • milestone changed from 6.12 branch to 6.12.3

  Changed 20 months ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.12.3 to 6.14.1

  Changed 14 months ago by igloo

  • milestone changed from 7.0.1 to 7.0.2

  Changed 11 months ago by igloo

  • milestone changed from 7.0.2 to 7.2.1

  Changed 4 months ago by igloo

  • milestone changed from 7.2.1 to 7.4.1
Note: See TracTickets for help on using tickets.