Path of current file when running via ghci

  • Anonymous

    Anonymous - 2012-06-17

    I have just started using EclipseFP, and I have to say I really like it (things like autocomplete are a joy to have..). I have a small question regarding the use of the interactive ghci. Currently when I right click on file and then choose "Run As->Run As GHCi session", I have to manually specify the path of the file via the ":cd" command. Is there a way of automatically getting eclipseFP to do this? p.s. In a 2008 post :

    leiffrenzel mentions that "I think in EclipseFP 2 the source folder is automatically put on the search path when running ghci", so I am thinking that maybe I just need to change something in the settings?

  • JP Moresmau

    JP Moresmau - 2012-06-18

    Sorry, what are you trying to do? Why do you use the cd command? According to the manual, the cd command will unload all the loaded modules, so you lose the benefits of running ghci on a specific file and having all the modules loaded. When you launch the GHCi session on a file it should load the corresponding module and put you in it so that everything inside your module is in scope.

  • asop

    asop - 2012-06-18

    Aha, from your comments above I realised what was the problem. I was launching the GHCi session by rightclicking on the main file, instead of the corresponding module file.

    So is there a way of launching the GCHi (by rightclicking the main file) and at the same time having all the other modules put in scope?, or do you have to launch the GHCi session by rightclicking over the corrresponding module file? The former would be useful in the event that you have multiple module files and you want to put ALL of them in scope. I guess you can create a single file with all the modules imported, but I am curious if there is another way.


  • JP Moresmau

    JP Moresmau - 2012-06-19

    No at the moment in EclipseFP, there is no other way. The GHCi session loads one particular file. Of course it will load all the modules it depends on, but it will only put you in the context of the one file.


Log in to post a comment.