Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 隐藏包二进制-0.7.5.0?_Haskell_Haskell Stack - Fatal编程技术网

Haskell 隐藏包二进制-0.7.5.0?

Haskell 隐藏包二进制-0.7.5.0?,haskell,haskell-stack,Haskell,Haskell Stack,我得到这个错误: Could not find module ‘Data.Binary’ It is a member of the hidden package ‘binary-0.7.5.0@binar_IvYoLp9H6Xy3zEH13MmZwd’. 在我使用GHCi 7.10.2版在堆栈项目中导入Data.Binary 奇怪的是,如果我通过stack exec GHCi执行GHCi,这不会出现,并且我无法通过stack安装较新版本的binary软件包,它看起来: D:\

我得到这个错误:

Could not find module ‘Data.Binary’
It is a member of the hidden package ‘binary-0.7.5.0@binar_IvYoLp9H6Xy3zEH13MmZwd’.
在我使用GHCi 7.10.2版在堆栈项目中导入
Data.Binary

奇怪的是,如果我通过
stack exec GHCi
执行GHCi,这不会出现,并且我无法通过stack安装较新版本的
binary
软件包,它看起来:

D:\p>stack install binary
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the install command is functionally equivalent to 'build --copy-bins'

D:\p>stack install binary-0.7.6.1
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the install command is functionally equivalent to 'build --copy-bins'
Error parsing targets: Specified target version 0.7.6.1 for package binary does not match snapshot version 0.7.5.0

D:\p>stack install binary-0.7.5.0
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the install command is functionally equivalent to 'build --copy-bins'

你将如何解决这个问题

binary
依赖项添加到您的
cabal
文件中

build-depends:       base >= 4.7 && < 5
                   , binary >= 0.7.5
构建取决于:base>=4.7&&<5
,二进制>=0.7.5

当您使用
stack install
时,您正在安装某些库或可执行文件,但不是作为依赖项安装(例如,是一个类似
yesod
的实用程序,或者您仅在
ghci
内部使用的某个库).

另请参见:另一条注释:将依赖项添加到.cabal文件实际上是使用堆栈安装库的主要方法。添加依赖项后,它将在第一次需要时自动安装(例如,当您运行
stack build
时)。感谢您提供的解决方案!但是为什么该包隐藏在任何堆栈包中而不在外部?@RyoichiroOka stack/cabal发现了该包(他们建议使用一个版本),但该包是为您的项目隐藏的(因为您没有将其包含在其中);包含不是自动的(许多语言中的常见行为),我想我明白了。谢谢你的回答:)