Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal repl, .ghci vs .cabal options #4572

Closed
ivan-m opened this issue Jun 19, 2017 · 7 comments
Closed

cabal repl, .ghci vs .cabal options #4572

ivan-m opened this issue Jun 19, 2017 · 7 comments

Comments

@ivan-m
Copy link
Collaborator

ivan-m commented Jun 19, 2017

I have a ~/.ghci with some options specified, such as :set -Wall.

In a recent project, I wanted to disable a particular warning, so I'll specify in the *.cabal file:

ghc-options: -Wall -Wno-unused-top-binds

However, if I then do a cabal repl, I still get those warnings. Shouldn't the local *.cabal options override the global .ghci ones?

@hvr
Copy link
Member

hvr commented Jun 19, 2017

I'm not sure we can do much here. Cabal just passes ghc-options as instructed to GHCi; but then GHCi reads the .ghci file on startup. We could pass -ignore-dot-ghci, is that what you're suggesting?

(btw, I way to workaround this is that should work is to use per-file {-# OPTIONS-GHC -Wno... #-})

@ivan-m
Copy link
Collaborator Author

ivan-m commented Jun 19, 2017

Preferably ghci would read .ghci first before the .cabal options are passed through. Though I gather this might not be possible.

@ivan-m
Copy link
Collaborator Author

ivan-m commented Jun 19, 2017

And I usually do specify options on a per file basis, but in this case I was trying to avoid CPP.

@hvr
Copy link
Member

hvr commented Jun 19, 2017

It could be possible, but for that we'd have to extend/change GHC to allow to control the point at which .ghci is evaluated relative to CLI flag handling. I just have no idea how much work it would be, and if it would be justifiable.

@ivan-m
Copy link
Collaborator Author

ivan-m commented Jun 19, 2017

I thought that might be the case, but thought it was worth asking :)

@ulysses4ever
Copy link
Collaborator

From the discussion above, I gather that OP finds confusing the order of argument processing in ghci. I can sympathize but I doubt we could do much about it, or whether it's even desirable to change the current behavior. Hence, I propose we close. If someone wants to champion the idea to pass --ignore-dot-ghci by default, they are free to open a fresh ticket.

@Mikolaj
Copy link
Member

Mikolaj commented Aug 22, 2022

Indeed, by this time we have backward compatibility to contend with. But ideas are still welcome (with a conservative migration plan). Closing. Thank you everybody.

@Mikolaj Mikolaj closed this as completed Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants