`stack haddock` groups modules incorrectly

未关闭
#6,864 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
haskell

调研方向

使用提供的 stack.yaml 和 package.yaml 重现该问题,然后检查详细的 stack haddock 调用以及生成的 all/index.html。比较 package-db 输入和模块分组;当依赖项出现在其正确的软件包组下(包括 base、transformers 和 mtl)时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Overview

When running stack haddock in a project, the generated documentation groups documentation modules in an unpredictable way.

Steps to reproduce

Create a trivial project with a few dependencies, like so:

# stack.yaml
snapshot:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/34.yaml
packages:
  - .

# package.yaml
dependencies:
  - base
  - storable-record

library:
  source-dirs: lib

Then run stack haddock. Then open the documentation at file:///<project>/.stack-work/install/<platform>/<hash>/<ghc>/doc/all/index.html.

In it, modules are not grouped in a way that makes sense. For instance:

  • all base modules are grouped under QuickCheck-2.15.0.1;
  • all transformers modules are grouped under semigroups-0.20.1;
  • all mtl modules are at the top level, not within a package group.

A call to $ stack haddock --verbose reveals that documentation is created with the following haddock call:

/$HOME/.ghcup/ghc/9.10.3/bin/haddock-ghc-9.10.3 \
  --optghc=-package-db=/$HOME/.stack/snapshots/x86_64-linux/8a23ab0f4c447aa1863c20e527e4f2aeeec2f0c3c2ab9fbe859c65d4c711ecc7/9.10.3/pkgdb \
  --optghc=-package-db=/$HOME/$PROJECT/.stack-work/install/x86_64-linux/8a23ab0f4c447aa1863c20e527e4f2aeeec2f0c3c2ab9fbe859c65d4c711ecc7/9.10.3/pkgdb \
  --gen-contents \
  --gen-index \
  -i ../ghc-boot-th-9.10.3-9679,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/ghc-boot-th-9.10.3-9679/ghc-boot-th.haddock \
  -i ../mtl-2.3.1-bcd6,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/mtl-2.3.1-bcd6/mtl.haddock \
  -i ../array-0.5.8.0-4471,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/array-0.5.8.0-4471/array.haddock \
  -i ../ghc-internal-9.1003.0-a65c,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/ghc-internal-9.1003.0-a65c/ghc-internal.haddock \
  -i ../storable-record-0.0.7,/$HOME/.stack/snapshots/x86_64-linux/03a149f03ae9045878c23602050e9feb226fcf703f9493ca6662ad2a61705976/9.10.3/doc/storable-record-0.0.7/storable-record.haddock \
  -i ../utility-ht-0.0.17.2,/$HOME/.stack/snapshots/x86_64-linux/03a149f03ae9045878c23602050e9feb226fcf703f9493ca6662ad2a61705976/9.10.3/doc/utility-ht-0.0.17.2/utility-ht.haddock \
  -i ../containers-0.7-bf99,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/containers-0.7-bf99/containers.haddock \
  -i ../splitmix-0.1.3.2,/$HOME/.stack/snapshots/x86_64-linux/03a149f03ae9045878c23602050e9feb226fcf703f9493ca6662ad2a61705976/9.10.3/doc/splitmix-0.1.3.2/splitmix.haddock \
  -i ../pretty-1.1.3.6-7ead,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/pretty-1.1.3.6-7ead/pretty.haddock \
  -i ../haddock-issue-0.0.0,/$HOME/$PROJECT/.stack-work/install/x86_64-linux/8a23ab0f4c447aa1863c20e527e4f2aeeec2f0c3c2ab9fbe859c65d4c711ecc7/9.10.3/doc/haddock-issue-0.0.0/haddock-issue.haddock \
  -i ../deepseq-1.5.0.0-268d,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/deepseq-1.5.0.0-268d/deepseq.haddock \
  -i ../template-haskell-2.22.0.0-5e01,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/template-haskell-2.22.0.0-5e01/template-haskell.haddock \
  -i ../random-1.2.1.3,/$HOME/.stack/snapshots/x86_64-linux/03a149f03ae9045878c23602050e9feb226fcf703f9493ca6662ad2a61705976/9.10.3/doc/random-1.2.1.3/random.haddock \
  -i ../ghc-bignum-1.3-9ca9,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/ghc-bignum-1.3-9ca9/ghc-bignum.haddock \
  -i ../QuickCheck-2.15.0.1,/$HOME/.stack/snapshots/x86_64-linux/03a149f03ae9045878c23602050e9feb226fcf703f9493ca6662ad2a61705976/9.10.3/doc/QuickCheck-2.15.0.1/QuickCheck.haddock \
  -i ../base-4.20.2.0-127e,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/base-4.20.2.0-127e/base.haddock \
  -i ../bytestring-0.12.2.0-825f,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/bytestring-0.12.2.0-825f/bytestring.haddock \
  -i ../semigroups-0.20.1,/$HOME/.stack/snapshots/x86_64-linux/03a149f03ae9045878c23602050e9feb226fcf703f9493ca6662ad2a61705976/9.10.3/doc/semigroups-0.20.1/semigroups.haddock \
  -i ../transformers-0.6.1.1-4229,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/transformers-0.6.1.1-4229/transformers.haddock \
  -i ../ghc-prim-0.12.0-d0f9,/$HOME/.ghcup/ghc/9.10.3/lib/ghc-9.10.3/lib/../../../share/doc/ghc-9.10.3/html/libraries/ghc-prim-0.12.0-d0f9/ghc-prim.haddock

I have tried running the same command without the package-db arguments, and it removes all grouping, which suggests that the issue stems from an incorrect grouping in the pkgdb files?

Stack version
$ stack --version
Version 3.9.3, Git revision c7eb8487a82d5c3e0b88d56f8b8a98be23223eb5 x86_64 hpack-0.39.1
主要语言
Haskell
星标
4.1k
派生
857
平均合并
17 小时 32 分钟
30 天内合并 PR
5

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

commercialhaskell/stack 的其他 Issue

查看 commercialhaskell/stack 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。