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 themonads-fdby default until you laterghc-pkg expose monads-fd, but software installed by Cabal will still be able to build against it.{-# LANGUAGE PackageImports #-}pragma, and change your import statement toimport "mtl" Control.Monad.State.mtlin theBuild-dependsline.The first is best for casual hacking, and the last is best for production builds.
These all assume you want the
mtlmodule and not themonads-fdmodule; otherwise swap them.