我正在尝试在使用同样优秀的Web框架amazonka构建的API的后端部分中使用优秀的AWS SDK yesod,但是我很难获得这两者的依赖关系图书馆一起工作。
我用
开始了scaffolded yesod项目stack new my-project yesod-mongo
使用最新版本的yesod(1.6.0)填充我的cabal文件。天真地将依赖项amazonka-core
和amazonka-ssm
(例如)添加到我的cabal文件中,然后返回
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for my-project-0.0.0:
amazonka-core must match -any, but the stack configuration has no specified version
(latest matching version is 1.5.0)
amazonka-ssm must match -any, but the stack configuration has no specified version
(latest matching version is 1.5.0)
needed since my-project is a build target.
根据建议,我尝试将amazonka-core-1.5.0
和amazonka-ssm-1.5.0
添加到extra-deps
下的stack.yaml文件中,但这不起作用:
Warning: WARNING: /home/ubuntu/my-project/my-project.cabal was modified manually.
Ignoring package.yaml in favor of cabal file. If you want to use package.yaml
instead of the cabal file, then please delete the cabal file.
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for amazonka-core-1.5.0:
conduit-1.3.0.2 from stack configuration does not match >=1.1 && <1.3 (latest
matching version is 1.2.13.1)
needed due to my-project-0.0.0 -> amazonka-core-1.5.0
经过一些挖掘后,看起来yesod模板构建的快照是lts-11.6,但是包含amazonka库的最新快照是lts-10.9。所以,我尝试从yesod-mongo模板再次构建项目,但这次指定了一个较旧的快照:
ubuntu:~$ stack new my-project yesod-mongo --resolver lts-10.9
Downloading template "yesod-mongo" to create project "my-project" in my-project/ ...
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- my-project/
Selected resolver: lts-10.9
Resolver 'lts-10.9' does not have all the packages to match your requirements.
classy-prelude version 1.3.1 found
- my-project requires ==1.4.*
classy-prelude-conduit version 1.3.1 found
- my-project requires ==1.4.*
classy-prelude-yesod version 1.3.1 found
- my-project requires ==1.4.*
http-conduit version 2.2.4 found
- my-project requires ==2.3.*
persistent version 2.7.1 found
- my-project requires ==2.8.*
persistent-mongoDB version 2.6.0 found
- my-project requires ==2.8.*
yesod version 1.4.5 found
- my-project requires ==1.6.*
yesod-auth version 1.4.21 found
- my-project requires ==1.6.*
yesod-core version 1.4.37.3 found
- my-project requires ==1.6.*
yesod-form version 1.4.16 found
- my-project requires ==1.6.*
yesod-static version 1.5.3.1 found
- my-project requires ==1.6.*
Using package flags:
- my-project: dev = False, library-only = False
现在我感到茫然而且有点沮丧。似乎模板可能忽略了快照规范。所以,我的问题是:
有没有办法从使用特定快照填充cabal和stack.yaml文件的模板构建脚手架网站?我还能做些什么才能让它发挥作用吗?
如果有帮助,很乐意提供更多信息。
编辑:我还尝试在上面的代码段中查看软件包的版本,虽然这解决了构建依赖项的问题,但现在脚手架网站没有编译(大概是因为事情有从yesod-1.4.5到yesod-1.6.0以有意义的方式改变了。
答案 0 :(得分:2)
不幸的是,截至目前,您无法使用yesod和amazonka的Commercial Haskell's堆栈模板。原因是:
让它运行的唯一方法是切换回旧版本的堆栈模板(实际使用stackage resolver 10.9的那些模板),然后使用它来创建一个新项目。幸运的是,Stack支持自定义堆栈模板:
$ stack new my-project https://raw.githubusercontent.com/github-user-id/stack-templates/master/my-template.hsfiles