首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Haskell Stack项目中构建yesod/amazonka依赖关系时遇到麻烦

在Haskell Stack项目中构建yesod/amazonka依赖关系时遇到麻烦
EN

Stack Overflow用户
提问于 2018-04-28 17:35:55
回答 1查看 214关注 0票数 3

我试图在使用同样优秀的web框架耶索德构建的API的后端部分使用优秀的AWS 耶索德,但我很难使这两个库的依赖关系协同工作。

我用脚手架开始了yesod项目

代码语言:javascript
复制
stack new my-project yesod-mongo

它用yesod的最新版本(1.6.0)填充了我的阴谋文件。天真地将依赖项amazonka-coreamazonka-ssm (例如)添加到我的cabal文件中

代码语言:javascript
复制
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.0amazonka-ssm-1.5.0添加到extra-deps下的stack.yaml文件中,但这不起作用:

代码语言:javascript
复制
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模板构建的快照似乎是基于islts-11.6构建的,但最新的快照是包含在其中的amazonka库是lts-10.9。因此,我再次尝试从yesod-mongo模板构建该项目,但这次指定了一个旧的快照:

代码语言:javascript
复制
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

现在我茫然不知所措,多了一点挫折。似乎模板忽略了快照规范。所以,我的问题是:

是否有方法从使用特定快照填充阴谋和stack.yaml文件的模板构建脚手架站点?我还能做些什么让这件事起作用吗?

如果有用的话,很乐意提供更多的信息。

编辑:我也尝试在上面的代码段中降低包的版本,虽然这解决了构建依赖关系的问题,但是现在这个脚手架站点没有编译(大概是因为事情已经从yesod-1.4.5变成yesod-1.6.0了)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-28 20:09:53

不幸的是,到目前为止,您不能使用带有yesod和amazonka的商业Haskell's堆栈模板。原因是:

让它工作的唯一方法是切换回堆栈模板的旧版本(那些模板实际上与堆栈解析器10.9一起工作),然后使用这些模板创建一个新项目。幸运的是,Stack支持自定义堆栈模板:

代码语言:javascript
复制
$ stack new my-project https://raw.githubusercontent.com/github-user-id/stack-templates/master/my-template.hsfiles
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50079324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档