-
Notifications
You must be signed in to change notification settings - Fork 710
cabal run +RTS ...
is confusing
#8641
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
Comments
cabal run ... +RTS ...
is confusingcabal run +RTS ...
is confusing
Is this something I could work on? I looked through the codebase, but am having trouble finding the right starting point for this. |
It is a bit tricky because it seems like the So, the first step is to try to write a Haskell program that can tell if it has been given any Then the next step would be to integrate that mechanism into cabal. Edit: I guess |
Right I see the issue, The |
From searching around bit it seems pretty doable.
now if I run Would this help? Using |
Yeah, that looks much better than As for the actual place where this should go, it should probably only warn if you are using the |
If I have a detection program in a cabal project, and I run For this reason I would think that if I run Perhaps someone else could give input on where it would be suitable to implement this? |
You can try it and see what happens: -- T3.hs
import GHC.Environment (getFullArgs)
main :: IO ()
main = do
putStrLn "Searching all args..."
args <- getFullArgs
print args
|
I was talking about the case where you use The point I was making is that then (likely) within cabal exactly the inverse will be true: if you run |
But if the |
My bad, of course that's correct, I wasn't thinking about it right. That additional check should be doable to implement as well. |
Perhaps something like this:
|
@Mikolaj @ulysses4ever Could you perhaps guide me in where to start implementing this, and if it is worthwhile to implement? It would be an extra check whenever you use |
It's definitely worthwhile. In what sense could that be an issue? E. g., would the very check (not the warnings) be visible to user in any way? Or do you mean vs code complication? If the latter, it's totally worth it. I think the best way to start is with a PR, a test written using one of the testing harnesses (probably cabal-testsuite is the easiest, but read CONTRIBUTING or test docs to make sure it suits your needs), then start hacking and see if the test passes and if the rest of CI burns. Experiment at will. Expect terrible effects at the start. Then it should be easier to assist you. If you are stuck on purely design or motivation matters (trade-offs, warning levels, etc.), perhaps then returning here, to the issue, makes sense. But usually nobody bothers and the PR gets re-purposed. |
It doesn't look expensive, I think we can add it directly in CmdRun.hs. Do we want this check to happen in |
I know I make similar mistakes with |
Thanks, I indeed meant it in terms of code complication. I'll start with a PR and try to write a test. |
Congrats on the PR, @BasLaa! Our convention is that issues are closed when PRs are merged to branch master, so let's not jump the gun. |
Sorry about that, I meant to close the issue from the other PR I was working on, my bad! |
Now it's ready to be closed🙂 |
Thank you, @BasLaa! |
I've seen multiple reports of issues that were caused by people writing
cabal run +RTS ...
with the intention of passing those RTS options to the program that they run. Instead cabal itself consumes those RTS options.Recently, this came up again on reddit.
The obvious solution is that users can just run
cabal run -- +RTS ...
. However, I think this is such a common mistake that it might warrant a custom warning. Would it be possible to show something like the following warning?There are also stackoverflow questions caused by this confusion:
The text was updated successfully, but these errors were encountered: