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

Warn when a package uses TH but doesn't tell about it to Cabal #1562

Open
23Skidoo opened this issue Oct 25, 2013 · 7 comments
Open

Warn when a package uses TH but doesn't tell about it to Cabal #1562

23Skidoo opened this issue Oct 25, 2013 · 7 comments

Comments

@23Skidoo
Copy link
Member

23Skidoo commented Oct 25, 2013

It seems like there are a lot of packages that use Template Haskell but don't tell Cabal about it via extensions or other-extensions. With GHC 7.8 (and probably also older ones) this can lead to build failures (see e.g. #1553). It'd be nice if we could do a check akin to #1455 and warn the user if this is the case.

This feature will likely require using GHC API, so perhaps we could combine it with #1455 - what we need is a ghc --make augmented to dump the dependency graph and the set of all enabled extensions before the actual compilation.

Update: see also #3081. If we implement this feature for TH, it will be easy to generalise for all extensions.

@ghost ghost assigned 23Skidoo Oct 26, 2013
@23Skidoo
Copy link
Member Author

Assigning to myself so I don't forget about this.

@seagreen
Copy link

Is there any chance other-extensions could be make an optional field for projects that don't use CPP (and thus can have all their extensions discovered programmatically)? Obviously if a human has to do the work of writing extensions then they have to do it, but it doesn't look like that's the case without CPP.

There's already a lot of boilerplate in .cabal files between extra-source-files, exposed-modules, etc. I understand why we have it (other languages may say "treat any .foo as a Foo file, and we want to be more precise), but I think we want to be careful about adding/enforcing more if we don't have to.

@seagreen
Copy link

PS Thanks for opening this, I definitely think enforcement is better than nothing.

@ezyang
Copy link
Contributor

ezyang commented Aug 31, 2016

@seagreen I am very sympathetic to your concern, but unfortunately having it be implicit would sort of miss the point, because the dependency solver wants to make decisions about what packages to choose without having to actually look at the Haskell files (it's got only the Cabal file, not the full tarball.)

Maybe the moral of the story is that Cabal metadata should be divided into two parts: one that is hand-written, and one that is machine generated. When you upload, you upload both parts (so you have to be able to generate the machine bits.)

@seagreen
Copy link

Maybe the moral of the story is that Cabal metadata should be divided into two parts: one that is hand-written, and one that is machine generated. When you upload, you upload both parts (so you have to be able to generate the machine bits.)

Something like this sounds absolutely fantastic:) Should we make a new issue to consider it? I think the problem you describe in your first paragraph (that even though the info is machine derivable, it needs to go in the cabal file so the solver can see it) will keep coming up until we get a proper place to store machine derivable info (which is really just a cache) separate from human written info.

@ezyang
Copy link
Contributor

ezyang commented Aug 31, 2016

Yes, a new issue seems like a good idea.

@seagreen
Copy link

Done!

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

7 participants