Skip to content

Haddock panic on TypeData, TypeFamilies and reexport

Summary

I could not exactly pinpoint why, but there seems to be a weird interaction between type data, type families, and reexports that causes Haddock to panic:

Haddock output - Click to expand
$ cabal haddock
Configuration is affected by the following files:
- cabal.project
Warning: The package list for 'hackage.haskell.org' is 58 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.8.4 -O1
In order, the following will be built (use -v for more details):
 - haddock-panic-repro-0.1.0.0 (lib) (first run)
Configuring library for haddock-panic-repro-0.1.0.0...
Preprocessing library for haddock-panic-repro-0.1.0.0...
Running Haddock on library for haddock-panic-repro-0.1.0.0...
[1 of 2] Compiling Inner            ( src/Inner.hs, nothing )
[2 of 2] Compiling Reexport         ( src/Reexport.hs, nothing )
Haddock coverage:
   0% (  0 /  3) in 'Inner'
  Missing documentation for:
    Module header
    Operation (src/Inner.hs:6)
    UpdateableInt (src/Inner.hs:8)
   0% (  0 /  4) in 'Reexport'
  Missing documentation for:
    Module header
    Operation (src/Inner.hs:6)
    Create (src/Inner.hs:6)
    Update (src/Inner.hs:6)
panic! (the 'impossible' happened)
  GHC version 9.8.4:
        tyConStupidTheta

Create
Call stack:
    CallStack (from HasCallStack):
      callStackDoc, called at compiler/GHC/Utils/Panic.hs:191:37 in ghc-9.8.4-inplace:GHC.Utils.Panic
      pprPanic, called at compiler/GHC/Core/TyCon.hs:2606:17 in ghc-9.8.4-inplace:GHC.Core.TyCon

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

Error: [Cabal-7125]
Failed to build documentation for haddock-panic-repro-0.1.0.0.

GHC can build the project just fine. I have created a repo as a minimal reproducer. I have stumbled upon #23524 (closed) while looking for related issues, but this seems to be different case, as the suggested workaround there does not resolve the issue. Some bits that could be helpful:

  • Not exporting UpdateableInt from module Inner fixes the issue
  • Additionally importing UpdateableInt from module Reexport also fixes the issue
  • Using DataKinds instead of TypeData fixes the issue

The issue seems to arise from exporting the type family from the definition module but not exporting it from the reexport module.

Steps to reproduce

https://gitlab.haskell.org/ozkutuk/haddock-panic-repro

Expected behavior

Haddocks should be produced without panic

Environment

  • GHC version used: 9.8.4
Edited by Berk Özkütük
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information