使用不在 Hackage 上的包
Using a package that's not on Hackage
我正在尝试使用 EuterpeaLite (https://github.com/Euterpea/EuterpeaLite),但它不在 Hackage 上。
我像这样导入它 import EuterpeaLite as EL
并像这样将它添加到我的 cabal 文件中:
build-depends:
base >=4.7 && <5
, postgresql-simple
, EuterpeaLite
但是当我 运行 stack build
或 stack 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包有特殊处理吗?
我使用了以下程序。
- 创建一个新的堆栈项目
stack new myproject --resolver=14.27
。我需要指定一个较旧的解析器,因为 EuterpeaLite 不会使用 lts-15.3
构建
在myproject
目录中,将以下行添加到stack.yaml
:
extra-deps:
- git: https://github.com/Euterpea/EuterpeaLite.git
commit: 5fe2d129bd3087dd78c0feaf4d35fc03ffd36215
同样是在myproject
目录下,我在package.yaml
添加了如下依赖:
dependencies:
- base >= 4.7 && < 5
- EuterpeaLite # <- added this line
- 运行
stack build
在 myproject
目录中。
如您所述,您可以更改 .cabal
文件,而不是使用 package.yaml
。
我正在尝试使用 EuterpeaLite (https://github.com/Euterpea/EuterpeaLite),但它不在 Hackage 上。
我像这样导入它 import EuterpeaLite as EL
并像这样将它添加到我的 cabal 文件中:
build-depends:
base >=4.7 && <5
, postgresql-simple
, EuterpeaLite
但是当我 运行 stack build
或 stack 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包有特殊处理吗?
我使用了以下程序。
- 创建一个新的堆栈项目
stack new myproject --resolver=14.27
。我需要指定一个较旧的解析器,因为 EuterpeaLite 不会使用lts-15.3
构建
在
myproject
目录中,将以下行添加到stack.yaml
:extra-deps: - git: https://github.com/Euterpea/EuterpeaLite.git commit: 5fe2d129bd3087dd78c0feaf4d35fc03ffd36215
同样是在
myproject
目录下,我在package.yaml
添加了如下依赖:dependencies: - base >= 4.7 && < 5 - EuterpeaLite # <- added this line
- 运行
stack build
在myproject
目录中。
如您所述,您可以更改 .cabal
文件,而不是使用 package.yaml
。