404 on Haddock page in `base`?

Hackage’s Haddock page for base’s Control.Applicative.optional* tries to link to Control.Monad.Except, but the resulting URL isn’t valid.

The link looks to be generated based on the comment including the item name in quotes, but Haddock isn’t properly linking to Except in Control.Monad, instead trying to link to the Control.Monad.Except. What’s the proper way to link to this, and how easy is it to submit an MR to base to fix this? Is it worth fixing? Thanks! :slight_smile:

*I imagine this isn’t how you spell the fully-qualified name for an item — corrections appreciated!
** I tried to add this as a proper footnote, but Discourse thought it was a link (dunno why) and prevented me from posting it due to my TL.

It is trying to link to the module Control.Monad.Except, which is defined in the mtl package. The link is syntactically valid, but trying to link to the wrong place for some reason. The link target should be https://hackage-content.haskell.org/package/mtl-2.3.2/docs/Control-Monad-Except.html.

1 Like

As noted in the haddock documentation for module links:

[…] whether the module is in scope isn’t checked and will always be turned into a link.

Since base does not depend on mtl, the target module presumably isn’t in scope. I suspect there’s no better option than to spell out the link manually:

[Control.Monad.Except](https://hackage.haskell.org/package/mtl/docs/Control-Monad-Except.html)

I guess how it works must be that if it’s not in scope, it assumes the module is in the same package, rather than giving up. It would be nice if there were a way to indicate the package in the Haddock, other than using the full URL, but it doesn’t look like there is.