使用 Stack 安装 Aeson 包
Installing Aeson package using Stack
要使用Json,我要安装Aeson包。
在 package.yaml
文件中,我将 - aeson
添加到 dependencies:
部分,我得到了一大堆错误,我在网上找不到,例如:“但是这个 GHC 启动包已被修剪。
我试图理解这些错误,但我一个也不懂。例如对于第一个:如果我做 stack ls dependencies
我得到 text 1.2.4.0
,它符合匹配项,那么为什么它不起作用?
有没有办法让 Stack 为我安装东西,而不必编辑 yaml 文件然后 运行 进入问题? (stack install
似乎什么都没做)
完整错误:
PS D:\Documents\Programming\Unity\Poging8_(catan)\HaskellServer> stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for aeson-1.4.7.1:
text must match >=1.2.3.0 && <1.3, but this GHC boot package has been pruned (issue #4510); you need to add the
package explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> aeson-1.4.7.1
In the dependencies for attoparsec-0.13.2.4:
text must match >=1.1.1.3, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> attoparsec-0.13.2.4
In the dependencies for ghc-boot-th-8.6.5:
base-4.13.0.0 from stack configuration does not match >=4.7 && <4.13 (latest matching version is 4.12.0.0)
needed due to HaskellCatanServer-0.1.0.0 -> ghc-boot-th-8.6.5
In the dependencies for hashable-1.3.0.0:
text must match >=0.12 && <1.3, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> hashable-1.3.0.0
In the dependencies for scientific-0.3.6.2:
text must match >=0.8, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> scientific-0.3.6.2
In the dependencies for template-haskell-2.14.0.0:
base-4.13.0.0 from stack configuration does not match >=4.9 && <4.13 (latest matching version is 4.12.0.0)
needed due to HaskellCatanServer-0.1.0.0 -> template-haskell-2.14.0.0
In the dependencies for time-1.8.0.4:
base-4.13.0.0 from stack configuration does not match >=4.7 && <4.13 (latest matching version is 4.12.0.0)
needed due to HaskellCatanServer-0.1.0.0 -> time-1.8.0.4
In the dependencies for uuid-types-1.0.3:
text must match >=1 && <1.3, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> uuid-types-1.0.3
Some different approaches to resolving this:
* Build requires unattainable version of base. Since base is a part of GHC, you most likely need to use a different
GHC version with the matching base.
Plan construction failed.
附加信息:
在 package.yaml
我有依赖项:
- base >= 4.7 && < 5
- network
- bytestring
- aeson
我没有手动编辑 stack.yaml
,我有解析器 lts-16.3 和 extra-deps:
- ghc-8.6.5@sha256:3591225289bdf8cf8f62b10f2aebc9ea3e25a15294545a5312a419e0317784f9,13976
- ghc-boot-8.6.5@sha256:8b608d2f36aad99a37a7d1b70319d43195128de6485b15fa7d4638b2942ce2a2,1772
- ghc-boot-th-8.6.5@sha256:c120f0d15944e770e2b698f5139f0003a86f9e25e5d1a7c6631e442129232748,1075
- ghci-8.6.5@sha256:886e52e6ab43b0de39fd5d92d8d1a5d7fac04c0f145c62b39baae04476208bd9,2126
- template-haskell-2.14.0.0@sha256:e3747ae9e2aeec160196706dd470b5fc4175678ec4136bcec9124534f67d83bc,1724
- time-1.8.0.4@sha256:3f6eddf238b828eb4f82683acce1c3afe64784f0d20114239b738c123316c85c,5494
stack ls dependencies
Win32 2.6.1.0
aeson 1.4.7.1
array 0.5.4.0
attoparsec 0.13.2.4
base 4.13.0.0
base-compat 0.11.1
base-compat-batteries 0.11.1
base-orphans 0.8.2
binary 0.8.7.0
bytestring 0.10.10.0
containers 0.6.2.1
deepseq 1.4.4.0
dlist 0.8.0.8
filepath 1.4.2.1
ghc-boot-th 8.6.5
ghc-prim 0.5.3
hashable 1.3.0.0
integer-gmp 1.0.2.0
integer-logarithms 1.0.3
network 3.1.1.1
pretty 1.1.3.6
primitive 0.7.0.1
random 1.1
rts 1.0
scientific 0.3.6.2
tagged 0.8.6
template-haskell 2.14.0.0
text 1.2.4.0
th-abstraction 0.3.2.0
time 1.8.0.4
time-compat 1.9.3
transformers 0.5.6.2
unordered-containers 0.2.10.0
uuid-types 1.0.3
vector 0.12.1.2
所以您的问题是 lts
和 extra-deps
版本之间的不匹配。正如@arrowd 评论的那样,解决方案是删除 extra-deps
部分......让我详细解释原因:
每个 lts
(a.k.a snapshot
) 都有一个关联的 ghc 版本。对于 lts-16.3,这样的版本是 ghc-8.8.3
,您可以查看链接文档。
当您在package.yaml
中编写依赖项时,stack
将使用在所选lts
中定义的版本,并且将从[=]中下载19=] 服务器。例如,在链接文档中,您可以搜索 aeson
包。 lts-16.3
中使用的版本是aeson-1.4.7.1
lts
中的所有软件包版本都保证可以很好地协同工作而不会出现依赖性问题。 (我认为堆栈网络中记录了一些例外情况,由于系统包但我不太确定)
问题来自extra-deps
。直接从 hackage
服务器下载,不保证依赖兼容性。在您的情况下,一个额外的部门是 ghc-8.6.5
。显然,快照中定义的编译器版本之间存在依赖性问题:ghc-8.8.3
和您想要作为 extra-dep ghc-8.6.5
的版本
希望它能澄清一些 stack
术语。
要使用Json,我要安装Aeson包。
在 package.yaml
文件中,我将 - aeson
添加到 dependencies:
部分,我得到了一大堆错误,我在网上找不到,例如:“但是这个 GHC 启动包已被修剪。
我试图理解这些错误,但我一个也不懂。例如对于第一个:如果我做 stack ls dependencies
我得到 text 1.2.4.0
,它符合匹配项,那么为什么它不起作用?
有没有办法让 Stack 为我安装东西,而不必编辑 yaml 文件然后 运行 进入问题? (stack install
似乎什么都没做)
完整错误:
PS D:\Documents\Programming\Unity\Poging8_(catan)\HaskellServer> stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for aeson-1.4.7.1:
text must match >=1.2.3.0 && <1.3, but this GHC boot package has been pruned (issue #4510); you need to add the
package explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> aeson-1.4.7.1
In the dependencies for attoparsec-0.13.2.4:
text must match >=1.1.1.3, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> attoparsec-0.13.2.4
In the dependencies for ghc-boot-th-8.6.5:
base-4.13.0.0 from stack configuration does not match >=4.7 && <4.13 (latest matching version is 4.12.0.0)
needed due to HaskellCatanServer-0.1.0.0 -> ghc-boot-th-8.6.5
In the dependencies for hashable-1.3.0.0:
text must match >=0.12 && <1.3, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> hashable-1.3.0.0
In the dependencies for scientific-0.3.6.2:
text must match >=0.8, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> scientific-0.3.6.2
In the dependencies for template-haskell-2.14.0.0:
base-4.13.0.0 from stack configuration does not match >=4.9 && <4.13 (latest matching version is 4.12.0.0)
needed due to HaskellCatanServer-0.1.0.0 -> template-haskell-2.14.0.0
In the dependencies for time-1.8.0.4:
base-4.13.0.0 from stack configuration does not match >=4.7 && <4.13 (latest matching version is 4.12.0.0)
needed due to HaskellCatanServer-0.1.0.0 -> time-1.8.0.4
In the dependencies for uuid-types-1.0.3:
text must match >=1 && <1.3, but this GHC boot package has been pruned (issue #4510); you need to add the package
explicitly to extra-deps (latest matching version is 1.2.4.0)
needed due to HaskellCatanServer-0.1.0.0 -> uuid-types-1.0.3
Some different approaches to resolving this:
* Build requires unattainable version of base. Since base is a part of GHC, you most likely need to use a different
GHC version with the matching base.
Plan construction failed.
附加信息:
在 package.yaml
我有依赖项:
- base >= 4.7 && < 5
- network
- bytestring
- aeson
我没有手动编辑 stack.yaml
,我有解析器 lts-16.3 和 extra-deps:
- ghc-8.6.5@sha256:3591225289bdf8cf8f62b10f2aebc9ea3e25a15294545a5312a419e0317784f9,13976
- ghc-boot-8.6.5@sha256:8b608d2f36aad99a37a7d1b70319d43195128de6485b15fa7d4638b2942ce2a2,1772
- ghc-boot-th-8.6.5@sha256:c120f0d15944e770e2b698f5139f0003a86f9e25e5d1a7c6631e442129232748,1075
- ghci-8.6.5@sha256:886e52e6ab43b0de39fd5d92d8d1a5d7fac04c0f145c62b39baae04476208bd9,2126
- template-haskell-2.14.0.0@sha256:e3747ae9e2aeec160196706dd470b5fc4175678ec4136bcec9124534f67d83bc,1724
- time-1.8.0.4@sha256:3f6eddf238b828eb4f82683acce1c3afe64784f0d20114239b738c123316c85c,5494
stack ls dependencies
Win32 2.6.1.0
aeson 1.4.7.1
array 0.5.4.0
attoparsec 0.13.2.4
base 4.13.0.0
base-compat 0.11.1
base-compat-batteries 0.11.1
base-orphans 0.8.2
binary 0.8.7.0
bytestring 0.10.10.0
containers 0.6.2.1
deepseq 1.4.4.0
dlist 0.8.0.8
filepath 1.4.2.1
ghc-boot-th 8.6.5
ghc-prim 0.5.3
hashable 1.3.0.0
integer-gmp 1.0.2.0
integer-logarithms 1.0.3
network 3.1.1.1
pretty 1.1.3.6
primitive 0.7.0.1
random 1.1
rts 1.0
scientific 0.3.6.2
tagged 0.8.6
template-haskell 2.14.0.0
text 1.2.4.0
th-abstraction 0.3.2.0
time 1.8.0.4
time-compat 1.9.3
transformers 0.5.6.2
unordered-containers 0.2.10.0
uuid-types 1.0.3
vector 0.12.1.2
所以您的问题是 lts
和 extra-deps
版本之间的不匹配。正如@arrowd 评论的那样,解决方案是删除 extra-deps
部分......让我详细解释原因:
每个
lts
(a.k.asnapshot
) 都有一个关联的 ghc 版本。对于 lts-16.3,这样的版本是ghc-8.8.3
,您可以查看链接文档。当您在
package.yaml
中编写依赖项时,stack
将使用在所选lts
中定义的版本,并且将从[=]中下载19=] 服务器。例如,在链接文档中,您可以搜索aeson
包。lts-16.3
中使用的版本是aeson-1.4.7.1
lts
中的所有软件包版本都保证可以很好地协同工作而不会出现依赖性问题。 (我认为堆栈网络中记录了一些例外情况,由于系统包但我不太确定)问题来自
的版本extra-deps
。直接从hackage
服务器下载,不保证依赖兼容性。在您的情况下,一个额外的部门是ghc-8.6.5
。显然,快照中定义的编译器版本之间存在依赖性问题:ghc-8.8.3
和您想要作为 extra-depghc-8.6.5
希望它能澄清一些 stack
术语。