ghci support in eclipsefp

  • Jonathan Gallagher

    I start a new haskell project and make two files
    module Foo where ...
    module Bar where
    import Foo ...

    The above builds with no errors (for all well defined modules Foo and Bar).  The trouble comes for me with loading Bar.  If I load Bar in hugs from eclipse, fine no problem, but if i load Bar in GHCi, I get the error,
    "could not find module 'Foo', Use -v to see a list of the files searched for."
    Then I open a terminal and change into the directory, and
    "GHCi Bar", and the file is loaded and linked no problem.  I don't mind using hugs, but for things like graphics it is inadequate.  I have tried enabling the checkbox for use ghc compiler settings for ghci, under windows>preferences>functional programming>interpreter>gchi but that did not help.  Is there a way to get these files to load from inside EclipseFP?

    In case it helps, I use Ubuntu 8.04, and installed both hugs and GHC through apt-get.  Also, the output from ghc-pkg -l is
    "    Cabal-, GLFW-0.3, OpenGL-, QuickCheck-,
        WordNet-0.1.2, array-, base-, bytestring-,
        containers-, directory-, filepath-,
        (ghc-6.8.2), haskell98-, hpc-, mtl-,
        old-locale-, old-time-, packedstring-,
        parsec-, pretty-, process-, random-,
        readline-, rts-1.0, template-haskell-, unix-

    By the way, I really like the eclipsefp environment, and thank you for your past help.

    • Leif Frenzel

      Leif Frenzel - 2008-12-14


      This looks like a difference in search path handling: ghc (when compiling, for which eclipsefp uses --make) and hugs seem to be more explorative. You could try to add -i. (note the dot) to the command line options in the preferences. Another thing that might help would be to open the launch config dialog (in the Run ... menu) after you have run ghci once, and set the work directory to the source folder. (I think in EclipseFP 2 the source folder is automatically put on the search path when running ghci).

      Thanks && ciao,

      • Andrew Frank

        Andrew Frank - 2008-12-15

        i experience similar problems. it seems that the search path is not set automatically to search the current directory.
        what i do is to add to the project properties the current directory (where the workspace, then the project, then the src ) as library to search.

        then close the workspace and open it again. for me then ghc works. and the setting is remembered and need not be changed untill you need to search files from another project, then add the source directory from this one as well. (and cloose/open workspace)

        hope this is clear enough and helps you!


    • Jonathan Gallagher

      thank you that helps

    • Jonathan Gallagher

      Mentioning EclipseFP2, is there a release date?  I tried installing the build and it seemed very nice; however, I get a cabal-builder error every time I hit save.  Is there a library I am missing?

    • Jonathan Gallagher

      Scratch that last comment, I just did a fresh install of EclipseFp2 on a fresh eclipse, and there are no errors.


Log in to post a comment.