【发布时间】:2020-10-27 00:21:44
【问题描述】:
我目前正在尝试开始使用 Haskell,因为我想将 Pandoc 的部分代码库用于不同的项目。由于我是 Haskell 的新手,我需要适当的 IDE 功能,例如 代码完成 和 跳转到定义 AND 类型信息 和悬停文档。我选择了带有Haskell extension 的VSCode 来完成这项工作。
现在我的问题来了:Pandoc 依赖于pandoc-types,它是代码的一个组成部分,我需要理解和修改它。但是使用ghc-option"$everything": -haddock(根据this,这应该是实现我的目标的正确方法)似乎没有给我正确的类型信息和悬停文档。由于我复制了整个 repo 并且不打算从原始 repo 中提取或推送,因此我想将 pandoc-types 中的代码添加到主 pandoc repo 中的现有 Haskell 代码中。
所以我尝试的一部分是下载pandoc-types 将.hs 文件移动到pandoc 中的相应目录中,将模块添加到.cabal 文件中,同时从@987654335 中删除pandoc-<version> 依赖项@ 文件和stack.yaml。但是我在构建时遇到的所有兼容性错误:
➜ pandoc git:(master) ✗ stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for citeproc-0.1.0.1:
pandoc-types-1.17.6 from stack configuration does not match >=1.22 && <1.23 (latest matching version is 1.22)
needed due to pandoc-2.11.0.1 -> citeproc-0.1.0.1
In the dependencies for commonmark-pandoc-0.2.0.1:
pandoc-types-1.17.6 from stack configuration does not match >=1.21 && <1.23 (latest matching version is 1.22)
needed due to pandoc-2.11.0.1 -> commonmark-pandoc-0.2.0.1
In the dependencies for texmath-0.12.0.3:
pandoc-types-1.17.6 from stack configuration does not match >=1.20 && <1.23 (latest matching version is 1.22)
needed due to pandoc-2.11.0.1 -> texmath-0.12.0.3
Some different approaches to resolving this:
* Set 'allow-newer: true' in /Users/johannes/.stack/config.yaml to ignore all version constraints and build anyway.
* Recommended action: try adding the following to your extra-deps in /Users/johannes/Programmieren/GITGOV/Pandocs/pandoc/stack.yaml:
- pandoc-types-1.22@sha256:15512ce011555ee720820f11cac0598317293406da5812337cbb1550d144e3bd,4071
Plan construction failed.
如何将依赖项中的 repo 更改为代码库的一部分。我尝试了一些不同的方法,但似乎没有任何效果。我对GHC、stack 和cabal 甚至Haskell 本身都不熟悉。或者还有其他方法可以让类型信息和悬停时的文档正常工作吗?
特别是作为一个 Haskell 初学者,我真的需要这个功能来正确掌握代码库。
也许也相关:
两个 repos 似乎都在构建过程中生成 Paths_*.hs 文件。据我了解,它们还需要像提到的here 一样复制到src/ 目录中。
【问题讨论】:
标签: haskell ghc cabal haskell-stack