[英]Could not find module `Control.Monad.Reader'
Today when I tried to compile my code in Geany I got this error 今天,当我尝试在Geany中编译代码时,出现了此错误
Could not find module `Control.Monad.Reader':
it was found in multiple packages: monads-fd-0.1.0.1 mtl-1.1.0.2
Compilation failed.
I get the same for the Writer monad; 我对Writer monad也是如此; I thought I should remove one of those packages, but I do not want to break other packages, so now what should I do, yesterday everything worked without any problem.
我以为我应该删除其中一个软件包,但我不想破坏其他软件包,所以现在我该怎么办,昨天一切正常。
It looks like you have recently installed monads-fd
, perhaps as a dependency of something else you installed. 看来您最近安装了
monads-fd
,也许是对您安装的其他产品的依赖。 Both monads-fd
and mtl
packages contain the module Control.Monad.Reader
, so GHC doesn't know which one to use when you compile some code that imports it. monads-fd
和mtl
软件包都包含模块Control.Monad.Reader
,因此,GHC在编译某些导入代码时不知道要使用哪个模块。 You need to resolve the ambiguity somehow: 您需要以某种方式解决歧义:
-hide-package <package>
flag on the command line to hide one of the packages, or -hide-package <package>
标志来隐藏其中一个程序包,或者 ghc-pkg hide <package>
. ghc-pkg hide <package>
隐藏该软件包。 You may need to use ghc-pkg --user hide <package>
if the package was installed in your home directory (the default on some platforms). ghc-pkg --user hide <package>
。 build-depends
field in your .cabal
file .cabal
文件中的build-depends
字段.cabal
您依赖哪个冲突软件包。 I encountered a similar problem recently, and it was suggested that I run ghc-pkg hide {x}
where '{x}' is the name of one of those packages. 最近我遇到了类似的问题,建议我运行
ghc-pkg hide {x}
,其中“ {x}”是这些软件包之一的名称。 It worked in my situation. 它在我的情况下有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.