Repository navigation
Conversation
|
We should maybe raise a warning if conflicting options are passed, such as: # Conflict! --with-compiler is already set by cabal-doctest and will be overriden
cabal doctest --with-compiler ghc-9.4 |
|
@sol |
sol
left a comment
There was a problem hiding this comment.
I kind of like the approach @mpickering took here: https://github.com/mpickering/cabal-doctest-demo/blob/master/cabal-doctest#L11-L14
Is this something you would be interested to explore further?
| , process | ||
| default-language: Haskell2010 | ||
| if impl(ghc >= 9.8) | ||
| ghc-options: -fno-warn-x-partial |
There was a problem hiding this comment.
This is a generated file. Please edit package.yaml instead.
| exitWith exitCode | ||
| where | ||
| mkArgs exePath opts = baseOpts exePath ++ opts | ||
| baseOpts exePath = ["repl", "--with-compiler", exePath, "--with-hc-pkg", ghc_pkg] |
There was a problem hiding this comment.
Will Cabal ensure that the project has been built before invoking external commands?
My default assumption is "no", and if that's the case, then I think we still need --with-repl to make this robust.
There was a problem hiding this comment.
Or given that we are in control now, maybe we are in a position to first invoke cabal with -w ghc and then with -w doctest.
There was a problem hiding this comment.
Will Cabal ensure that the project has been built before invoking external commands?
Yes, please give it a try.
There was a problem hiding this comment.
From what I tried, I think it doesn't.
There was a problem hiding this comment.
I just tried again:
- Delete
dist-newstyle(or use --builddir`) - Run
cabal doctest-9.8 -b QuickCheck
It does run the tests.
There was a problem hiding this comment.
Ok. I do not understand why this is relevant then. Doctest run the tests with success, which seems the only thing that matters in my opinion.
There was a problem hiding this comment.
If you don't understand something, please always feel free to ask.
This is the relevant part from the README:
Technically,
cabal buildis not necessary.cabal repl --with-ghc=doctestwill build any dependencies as needed. However, it's more robust to runcabal buildfirst (specifically it is not a good idea to buildghc-pathswith--with-ghc=doctest).
Or in other words, before invoking cabal repl,, you have to run cabal build.
I'm giving this a stab right now, BTW.
There was a problem hiding this comment.
If you don't understand something, please always feel free to ask.
If you want to ask something, please always feel free to give the full context.
All examples I have seen only involved cabal repl, and my current PR just works in my testing. So I believe you if you say it’s more robust, even if I do not know in what way: what can go wrong without cabal build?
If you would have mentioned the note in your first comment it would have been clear and we would have both avoid losing time. This is my first contribution to this project, I do not know all the edge cases and it is not clear where the technical documentation of this one is.
There was a problem hiding this comment.
I do not know in what way: what can go wrong without
cabal build?
OK, I think that's the source of the misunderstanding. I mentioned that before here:
There's still the issue that when
doctestacts as a proxy for GHC, then theghc-pathspackage is not complied correctly (not sure if any other package are affected). For that reason a user should always do a clean build first, before invokingcabal repl --with-ghc=doctest.
That's why I assumed you have the full picture.
That's also the reason why I kept pressing for--with-repl, which would eliminate the problem + I think that's also the reason why Matthew included this line in his script.
If you want to understand for what reason ghc-paths is not compiled correctly with --with-ghc=doctest then study https://github.com/simonmar/ghc-paths/blob/master/Setup.hs#L68.
Let's keep this constructive.
There are actual problems that need solving (e.g. this line, the cabal exec, is there for reason, and I think it makes things complicated, more on that later…).
There was a problem hiding this comment.
While I really appreciate that you now took time to give me the full picture, I do not feel I can be helpful here anymore.
I missed the important point of your comment when I created this PR 2 months ago, so it was unlikely I would understood the issue without some reference.
I am glad that at least my attempts motivate you to tackle #396.
I fail to see how this script allow you to select the GHC version apart than executing before it Or do you mean only the bits to ensure But I think something like
Note that the suffix should be the corresponding full GHC numeric version.
I am currently quite busy. |
I think you could do something like:
I think that makes sense as a starting point.
Yes, possibly, but I think it's better to defer that. First get the base case right, then explore this as a follow up.
Yes, exactly 👍
I think it's more robust to always install
I would try to directly invoke You will need to determine
I think just always do the install, if it's in the store it's literally just creating a symlink. That simplifies the control flow.
If you always install, this doesn't really matter anymore. You can just use some temporary path. |
While it would work, it creates a temporary directory and symlink all the toolchain. I would like to save any useless write to my SSD and keep the run fast.
Fair enough.
And detect if it fails? It may fail for other reason. No, I think it is much easier to detect if the executable is in path.
And we are back at the initial issue 😅
As I wrote above, I would prefer to keep the workflow I propose. But I would change to
This is puzzling me. Why would you create a temporary dir at each execution? In fact I meant to write (fixed):
|
Not really. Before we were trying to determine
I think it's better not to modify the user environment. Also note, that any invocation of Unless proven otherwise I assume that creating a temporary directory with two symlinks is negligible for the overall picture. We could add cashing in a second step, but again I would do that in some |
The whole issue is about cabal, not stack. I am not using stack.
I do not follow. I thought the recent discussion was to add ergonomics:
What I propose seems simple to me:
I do not see why we would need to change the
I do not think so. But this is hard to debate until there is actually some code.
I think the design is sound. And this is just using the cabal options properly, so not exactly an optimization.
Hmm if we install doctest we do modify the user environment: the cabal store. If a user do not want to modify the default store, they can specify explicitly another path for a new store. But I do not see why installing e.g.
I do not see how this is relevant here: I am not criticizing temporary files in general, only your proposal because I do not see the added value.
Right, but the added value has to be proven. I am now demotivated with adding any new feature to this PR, because it seems our views diverge too much. So far you have not even commented the current feature of the PR. You keep referring to the work of Matthew, so I may end just closing this PR and create a This is my second attempt to fix #396 after haskell/cabal#10057. It works quite well and only misses the setup step. If there is so much debate about the setup step, maybe it is simply a false good idea, because there are too different use cases. In those cases I usually stick to the Unix philosophy: do one thing well, e.g. the current feature of this PR. |
|
That's a fair point, #425 is my stab on this.
It turns out that
This is my most important concern, so if we at least agree on this point then I think we still have some common ground. I haven't mentioned this explicitly, why is this important?
In addition:
(both are true for #425, but not for this PR) EDIT: @wismill Actually (3) is true for your current code. If you're still interested in collaborating on this, then I'd love to get your feedback on #425. At this point, I think this is what's missing:
|
Following the discussion in haskell/cabal#10057, this PR adds the executable
cabal-doctestto be use as a cabal external command, like so:Fixes #396