在多个包中找到的Control.Monad.State haskell [英] Control.Monad.State found in multiple packages haskell

查看:133
本文介绍了在多个包中找到的Control.Monad.State haskell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在评估Haskell模块中的import Control.Monad.State行时,GHC给了我以下错误:


 找不到模块`Control.Monad.State':
在多个软件包中找到它:monads -fd-0.0.0.1 mtl-1.1.0.2
失败,模块加载:无。


如何解决此冲突?

解决方案

你有几个选择。或者:


  • ghc-pkg隐藏monads-fd 。这将导致GHC和GHCi默认忽略 monads-fd 的存在,直到您稍后 ghc-pkg公开monads-fd ,但由Cabal安装的软件仍然可以针对它进行构建。

  • 使用 { - #LANGUAGE PackageImports# - } pragma,并将您的导入语句更改为导入mtlControl.Monad.State

  • 使用Cabal构建项目,并在 Build-depends 行中指定 mtl



第一个对于偶然黑客来说是最好的,而最后一个对于生产构建来说是最好的。

这些都假设您需要 mtl 模块,而不是 monads-fd 模块;否则交换它们。


While evaluating the line "import Control.Monad.State" in a Haskell module, GHC gives me the following error:

Could not find module `Control.Monad.State':
  it was found in multiple packages: monads-fd-0.0.0.1 mtl-1.1.0.2
Failed, modules loaded: none.

How do I resolve this conflict?

解决方案

You have several options. Either:

  • ghc-pkg hide monads-fd. This will cause GHC and GHCi to ignore the presence of the monads-fd by default until you later ghc-pkg expose monads-fd, but software installed by Cabal will still be able to build against it.
  • Use the {-# LANGUAGE PackageImports #-} pragma, and change your import statement to import "mtl" Control.Monad.State.
  • Use Cabal to build your project, and specify mtl in the Build-depends line.

The first is best for casual hacking, and the last is best for production builds.

These all assume you want the mtl module and not the monads-fd module; otherwise swap them.

这篇关于在多个包中找到的Control.Monad.State haskell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆