stack.yaml
内容如下:
resolver: lts-16.19
packages:
- .
extra-deps:
- text-1.2.4.0
- random-1.2.0
- git: https://github.com/LeventErkok/sbv.git # sbv
commit: 4f4baa7b5970ef2ab9b322c6694bf9df6ccdbc4b
- git: https://github.com/bos/aeson # aeson
commit: 8579faf30e0f977425fbf330038fb1d5c2c34727
- data-fix-0.3.0@sha256:058a266d1e658500e0ffb8babe68195b0ce06a081dcfc3814afc784b083fd9a5,1645
- strict-0.4@sha256:1b50c7c9c636c3a1bbc7f8873b9be48f6ca0faca4df6eec6a014de6208fb1c0e,4200
虽然 test
有这个部分:
executable test
hs-source-dirs: src
main-is: Main.hs
default-language: Haskell2010
build-depends: text, random, sbv, aeson, base >= 4.7 && < 5
我添加了 text
和 random
因为如果我不这样做,在运行 stack ghci
时会出现以下错误:
Could not load module ‘Data.Text’
Could not load module ‘System.Random’
但是现在,按照上面的方式添加了这些包,Stack 提示循环依赖:
$ stack setup
$ stack ghci
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for QuickCheck-2.13.2:
random dependency cycle detected: random, splitmix, random, uuid-types, aeson, test
needed due to test-0.1.0.0 -> QuickCheck-2.13.2
In the dependencies for test-0.1.0.0:
random dependency cycle detected: random, splitmix, random, uuid-types, aeson, test
needed since test is a build target.
Dependency cycle detected in packages:
[random,splitmix,random,uuid-types,aeson,test]
In the dependencies for sbv-8.8.5:
random dependency cycle detected: random, splitmix, random, uuid-types, aeson, test
needed due to test-0.1.0.0 -> sbv-8.8.5
In the dependencies for splitmix-0.0.5:
random dependency cycle detected: random, splitmix, random, uuid-types, aeson, test
needed due to test-0.1.0.0 -> splitmix-0.0.5
Some different approaches to resolving this:
Error: Plan construction failed.
根据错误消息,它看起来在 splitmix
和 random
之间有一个循环。我只要求 random
因此我不确定如何解决这个问题。
任何解决此问题并使导入工作同时避免循环导入问题的方法都将不胜感激。
最佳答案
最新的 random
与 lts-16.19
快照中的旧版本 splitmix
不兼容。在 extra-deps
中添加更新版本的 splitmix
:
extra-deps:
- ... # your other extra-deps
- splitmix-0.1.0.3
关于haskell - 堆栈 : random dependency cycle(s) detected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64524050/