.ghci runs after flag parsing?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

.ghci runs after flag parsing?

Evan Laforge
I just noticed that it appears flag parsing happens before executing
.ghci.  And sure enough, looking at the source, GHCi.UI.runGHCi
executes the dot files, which is definitely after all the dynflags
parsing stuff in Main.

This means that if your .ghci has a -Wall, you can't turn off warnings
from the command line.  You have to prepend ":set " to the flags and
make a local ./.ghci, or pass -ghci-script.

I assume this has how it's already been, and I'm surprised it's taken
me this long to notice this!  Is there a good reason to do it this
way, or is it just the way it's always been and no one complained?
It's surprising to me because I think most programs do it the other
way.  E.g. when you start your shell, settings on the command line
will override your .zshrc or whatever.  zsh for one doesn't seem to
clearly document this, but experimenting seems to indicate that is so.

I can put all my flags in a -ghci-script without too much trouble,
it's just a surprising default.
Glasgow-haskell-users mailing list
[hidden email]