scruffaluff
scruffaluff

Reputation: 365

Multiple .ghci Files

I have a .ghci file with configurations for a Haskell project in the directory Project. When I run ghci from the Mac terminal in the directory Project, ghci loads both the project's Project/.ghci file and the home directory ~/.ghci file. Is there a method to prevent the ~./ghci configurations from being loaded or have the Project/.ghci overwrite the ~./ghci configurations?

Upvotes: 1

Views: 106

Answers (1)

Jack Henahan
Jack Henahan

Reputation: 1386

Unfortunately, this isn't how ghci works according to the docs. It loads all .ghci files in order, starting with the one in the current directory, which is why your prompt is taking on the value in your root .ghci rather than the one in the project.

You may have a better experience removing the .ghci files and using cabal new-build and cabal new-repl, assuming your project is Cabalized. This doesn't give you an option to set the prompt, but if that's an important element then you could always retain the .ghci at the project level and remove the global one. You'll still be able to specify available modules and extensions, though.

Upvotes: 2

Related Questions