`stack haddock` groups modules incorrectly

オープン
#6,864 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
5

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

commercialhaskell/stack のほかの issue

commercialhaskell/stack の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。