Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Panic with package keys and --hoogle #353

@luite

Description

@luite

Haddock needs the package version and name to generate a hoogle index. Before package keys, this could be (de)constructed from the passed in package name. The lookup code has since been changed to get the version from the package db.

This works, as long as the package key can be found in one of the package databases, which is not always the case for the package currently being compiled. Since cabal can now generate documentation for executables and test suites, we can't rely on the inplace package database either.

To reproduce the panic:

module Test where
test = test
$ haddock --hoogle Test.hs

The same panic can be triggered with cabal haddock when --hoogle is enabled. Make sure the package hasn't been installed before, otherwise the packagekey can be found in the user package db.

I think we need a new command line option to pass in the package name and version, since it can't be determined from the package key anymore. -package-name is deprecated in GHC 7.10 too, and relying on a --optghc option for this isn't a great solution in any case. Cabal also needs to be updated, since it's still using the deprecated -package-name flag with haddock.

A quick fix: rely on Cabal passing in --optghc=-package-name --optghc=packagename-version and use the name/version pair as a fallback when looking up the package with GhcUtils.modulePackageInfo fails.

Proper fix? Add command line options --package-name and --package-version to haddock, update Cabal to pass these in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions