簡體   English   中英

無法在Haskell Stack項目中構建yesod / amazonka依賴項

[英]Trouble building yesod/amazonka dependencies in a Haskell Stack project

我正在嘗試在使用同樣出色的Web框架yesod構建的API的后端部分中使用優秀的AWS SDK amazonka ,但是我很難讓這兩個庫的依賴項協同工作。

我開始使用scaffolded yesod項目

stack new my-project yesod-mongo

用最新版本的yesod(1.6.0)填充我的cabal文件。 amazonka-core將依賴性amazonka-coreamazonka-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.0amazonka-ssm-1.5.0extra-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,但是亞馬遜卡庫中包含的最新快照是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)。

不幸的是,到目前為止,您無法使用商業Haskell的堆棧模板與yesod和amazonka。 原因是:

讓它工作的唯一方法是切換回舊版本的堆棧模板(那些實際上與stackage解析器10.9一起使用的模板),然后使用它來創建一個新項目。 幸運的是,Stack支持自定義堆棧模板:

$ stack new my-project https://raw.githubusercontent.com/github-user-id/stack-templates/master/my-template.hsfiles

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM