-
Notifications
You must be signed in to change notification settings - Fork 704
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 init --lib
puts build-tools(happy, alex) generated modules twice into exposed-modules
#7251
Comments
Er, that is what I thought, but I can only reproduce it for 3.2.0.0. For 3.5.0.0 (current master), no modules are inferred, Could someone test whether |
…--lib This should fix the problem that duplicate entries end up in exposed-modules, e.g. from Foo.x and Foo.hs (with alex as build-tool).
One could argue that cabal isn't totally wrong either: you do have duplicated modules in your source tree (the behavior you are observing only happens when you have both A.hs and A.x). Silently ignoring them could lead to confusion, so I think in this case cabal should at least warn about it. |
Cannot reproduce, but note that the default source directory was moved from |
Not sure I follow here. After stripping the extension it is simply a duplicate entry in a list, this can never be interpreted as two different modules. I think it is safe to assume that if you have both
|
Thanks, that helps! Btw, I noticed that
Also, shouldn't |
That's the point I'm making: it kinda is a duplicate entry already
In all those cases a warning seems sensible to me. |
This does not work well, because from the generated It is important to keep in mind that
Please sketch a realistic scenario where the user would shoot themselves in the foot with my PR. |
That's why it should be a warning: the dependencies are inferred and the package generated, then the user is reminded to delete the generated file
edit: Of course this is already possible if the user deletes the duplicate module without also remembering to delete the generated file |
Have you tried this in practice? What I observe:
This confirms my point of view. I am happy to be disproven, but please test your counter scenario first. UPDATE: I think a module |
I did test my scenario, but perhaps I wasn't clear enough. We are describing the same thing: the .hs stays there, out of sync, but does not cause build failures, it's just garbage data. I think we are in disagreement only on whether the fact that there is an unused and outdated .hs in the sdist/vcs is a problem or not edit: and on whether |
cabal init
nicely auto-detectsbuild-tools
likehappy
andalex
. However, it puts their generated modules twice intoexposed-modules
, like:Note that
Foo.Lex
andFoo.Par
are listed twice each.cabal build
then fails with a confusing error message:That's hard to understand. Took me a while, esp. since I didn't know where to look for the "inplace package".
I suppose a simple
nub
would solve this issue. Anyway, the order inexposed-modules
looks random, wouldn't it anyway be nicer in alphabetical order? ThenSet.toList . Set.fromList
would do the job.Tested
cabal
versions: 3.2.0.0 and 3.5.0.0.Steps to reproduce (using BNFC to generate .x and .y files cheaply):
Trivium:
hpack
had the very same problem: sol/hpack#406The text was updated successfully, but these errors were encountered: