Haddock:无法创建依赖关系图(添加带有 * 或模块标题的部分时)

发布于 2024-08-01 22:33:38 字数 1391 浏览 4 评论 0 原文

我从 tarball 源编译并安装了 haddock-2.4.2。

在此处的代码中添加一些简单的注释:

并运行 haddock

$ haddock -h -o doc Data/DualMap.hs
Warning: Data.DualMap: could not find link destinations for:
    Data.Typeable.Typeable2 GHC.Base.Eq GHC.Show.Show GHC.Base.Ord GHC.Base.Bool Data.Set.Set

产量:

事情看起来不错。 (请注意,此模块仅依赖于 GHC 附带的库,而不依赖于其他源模块。)

但是,当我尝试添加部分时(a la http://www.haskell.org/haddock/doc/html/ch03s04.html#id289234 ) 在注释中带有“-- * test “我得到:

$ haddock -h -o doc Data/DualMap.hs
Data/DualMap.hs:20:0: parse error on input `-- * test'
haddock: Failed to create dependency graph

我不知道从哪里开始让它工作,因为这个错误消息只告诉我 Haddock.Interface.depanal 没有返回任何内容(根据 haddock 源的 grep),但不告诉我如何阻止依赖关系分析失败。 也许我需要更多的命令行参数或对 GHC/base/containers 文档或某些 haddock 配置文件中缺少的链接目标的引用?

在 Google 上搜索后,发现了大量与 hackage 上的软件包类似的阴谋集团构建错误,但没有提及如何修复它们。

如何添加部分(带星号)并让 Haddock 生成我的文档? 我错过了什么(可能很简单)?

I compiled and installed haddock-2.4.2 from the tarball source.

Adding a few simple comments to the code here:

and running haddock

$ haddock -h -o doc Data/DualMap.hs
Warning: Data.DualMap: could not find link destinations for:
    Data.Typeable.Typeable2 GHC.Base.Eq GHC.Show.Show GHC.Base.Ord GHC.Base.Bool Data.Set.Set

yields:

Things look good. (Note that this module only depends on libs that ship with GHC and no other source modules.)

However, when I try to add sections (a la http://www.haskell.org/haddock/doc/html/ch03s04.html#id289234 ) in the comments with "-- * test" I get:

$ haddock -h -o doc Data/DualMap.hs
Data/DualMap.hs:20:0: parse error on input `-- * test'
haddock: Failed to create dependency graph

I have no idea where to begin getting this to work since this error message only tells me that Haddock.Interface.depanal returned Nothing (according to a grep of the haddock sources) but not how to stop the dependency analysis from failing. Perhaps I need some more command line arguments or references to missing link destinations in GHC/base/containers documentation or some haddock config file?

Searching Google yielded plenty of cabal build errors of the same ilk for packages on hackage but nothing about how to fix them.

How do I add sections (with asterisks) and get Haddock to generate my docs? What (probably simple thing) am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山人契 2024-08-08 22:33:38

简单修复(可怕的错误消息):

将 ( 移到模块名称所在的行。以前的错误代码:

module Data.DualMap
   -- * The @DualMap@ abstract type
   ( DualMap ()
   -- * (?) internal? -- exposed for testing purposes, for now...
   , dmFlip
   -- * converting to and from DualMap
   , toList, fromList, map
   -- * constructing a DualMap
   , empty, null, insert, union

快乐的代码看起来像这样:

module Data.DualMap (
   -- * The @DualMap@ abstract type                                                                                                                                 
     DualMap ()
   -- * (?) internal? -- exposed for testing purposes, for now...                                                                                                   
   , dmFlip
   -- * converting to and from DualMap                                                                                                                              
   , toList, fromList, map
   -- * constructing a DualMap                                                                                                                                      
   , empty, null, insert, union

足够简单。我通过下载 DList from hacakge 并将其删除并用我自己的代码替换代码。当 DList 与 'cabal haddock' 一起工作而我的没有(当我尝试添加一些星号时),我查看了文件之间的差异,果然我的括号在错误的行上。

顺便说一句,我强烈推荐 DList 作为新 Haskell 项目的起点,而不是 hnop

Simple fix (terrible error message):

Move the ( up to the line with the module name. Previous bad code:

module Data.DualMap
   -- * The @DualMap@ abstract type
   ( DualMap ()
   -- * (?) internal? -- exposed for testing purposes, for now...
   , dmFlip
   -- * converting to and from DualMap
   , toList, fromList, map
   -- * constructing a DualMap
   , empty, null, insert, union

Happy code looks like this:

module Data.DualMap (
   -- * The @DualMap@ abstract type                                                                                                                                 
     DualMap ()
   -- * (?) internal? -- exposed for testing purposes, for now...                                                                                                   
   , dmFlip
   -- * converting to and from DualMap                                                                                                                              
   , toList, fromList, map
   -- * constructing a DualMap                                                                                                                                      
   , empty, null, insert, union

Simple enough. I found this out by downloading DList from hacakge and gutting it and replacing the code with my own code. When DList worked with 'cabal haddock' and mine didn't (when I tried to add some asterisks), I looked at the difference between the files and sure enough my parenthesis was on the wrong line.

BTW I highly recommend DList as a starting place for a new Haskell project instead of hnop.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文