【问题标题】:Using a package that's not on Hackage使用不在 Hackage 上的包
【发布时间】:2020-03-14 02:18:04
【问题描述】:

我正在尝试使用 EuterpeaLite (https://github.com/Euterpea/EuterpeaLite),但它不在 Hackage 上。

我像 import EuterpeaLite as EL 这样导入它,然后像这样将它添加到我的 cabal 文件中:

build-depends:
base >=4.7 && <5
, postgresql-simple
, EuterpeaLite

但是当我运行stack buildstack ghci 时,我得到了这个错误:


Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for engine-0.1.0.0:

EuterpeaLite needed, but the stack configuration has no specified version (no package with that name found, perhaps there

is a typo in a package's build-depends or an omission from the stack.yaml packages list?)

needed since engine is a build target.

Some different approaches to resolving this:

Plan construction failed.

对于非 Hackage 包有特殊处理吗?

【问题讨论】:

  • 我试过这个:packages: - deepseq-1.4.4.0 - Euterpea-2.0.7@sha256:81d583a47d483bf83ac07df7b764138f1aa52a56db4e7c7f685d070dbac4b388,2661 - location: git: https://github.com/Euterpea/EuterpeaLite.git commit: 5fe2d129bd3087dd78c0feaf4d35fc03ffd36215 并收到同样的错误。
  • @LevelChart8 你需要把它放在extra-deps,而不是packagespackages 用于列出您的 Stack 项目中的包; extra-deps 用于列出不在您的堆栈解析器中的任何额外依赖项。

标签: haskell haskell-stack


【解决方案1】:

我使用了以下程序。

  1. 创建一个新的堆栈项目stack new myproject --resolver=14.27。我需要指定一个较旧的解析器,因为 EuterpeaLite 不会使用 lts-15.3 构建
  2. myproject目录中,将以下行添加到stack.yaml

    extra-deps:
    - git: https://github.com/Euterpea/EuterpeaLite.git
      commit: 5fe2d129bd3087dd78c0feaf4d35fc03ffd36215
    
  3. 同样在myproject目录下,我给package.yaml添加了如下依赖:

    dependencies:
    - base >= 4.7 && < 5
    - EuterpeaLite           # <- added this line
    
  4. myproject 目录中运行stack build

如您所述,您可以更改您的 .cabal 文件,而不是使用 package.yaml

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多