Menu

Import Data.Map fails (?)

Help
LeO
2014-02-17
2014-02-18
  • LeO

    LeO - 2014-02-17

    When I type just the line

    import Data.Map

    then I get the following error:

        Could not find module `Data.Map'
        It is a member of the hidden package `containers-0.5.0.0'.
        Perhaps you need to add `containers' to the build-depends in your .cabal file.
        Use -v to see a list of the files searched for.
    Failed, modules loaded: none.
    

    But when I type Data.<CTRL-SPACE> I get a list from which I could choose Data.Map. So, what fails with my setup? (In the WinGHCi the module could be loaded without any problems.)

     
  • JP Moresmau

    JP Moresmau - 2014-02-17

    GHCi puts all packages in scope, which is not the case of a Cabal built project. Since EclipseFP is using Cabal to know which packages your project references, this is normal. The error above is because EclipseFP gives you all possible imports, but you don't have the corresponding package in your cabal file. Just choose quick fix on the error, and choose add containers to cabal file, EclipseFP will do the modification for you and your code will compile.

     
  • JP Moresmau

    JP Moresmau - 2014-02-17

    GHCi puts all packages in scope, which is not the case of a Cabal built project. Since EclipseFP is using Cabal to know which packages your project references, this is normal. The error above is because EclipseFP gives you all possible imports, but you don't have the corresponding package in your cabal file. Just choose quick fix on the error, and choose add containers to cabal file, EclipseFP will do the modification for you and your code will compile.

     
  • LeO

    LeO - 2014-02-18

    Thx. this solved the problem.

     

Log in to post a comment.