Control.Monad.State found in multiple packages haskell

丶灬走出姿态 提交于 2019-12-02 18:13:36
Reid Barton

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.

Both packages implement Control.Monad.State and GHC does not know which implementation it should prefer, so you need to hide one of the packages from GHC. Seems like the -ignore-package <name> GHC flag might help you here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!