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

parsec for cabal-install #4235

Merged
merged 4 commits into from
Jan 26, 2017
Merged

Conversation

phadej
Copy link
Collaborator

@phadej phadej commented Jan 15, 2017

No description provided.

@mention-bot
Copy link

@phadej, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts, @owst and @23Skidoo to be potential reviewers.

@ezyang
Copy link
Contributor

ezyang commented Jan 16, 2017

The cabal-install patch doesn't actually work, right? Because the parsec flag doesn't control whether the Cabal parsec flag is toggled, and you really need it to be True. But there's no way to declare that you need a flag toggled on a library.

Maybe best to bite the bullet and have Cabal unconditionally build the Parsec bits.

readPackageDescription =
readAndParseFile withUTF8FileContents parsePackageDescription
readPackageDescription = readGenericPackageDescription
{-# DEPRECATED readPackageDescription "Use readGenericPackageDescription" #-}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clients tend to appreciate it when you explain why the new name is "better".

@phadej
Copy link
Collaborator Author

phadej commented Jan 16, 2017

Cabal cannot build parsec unconditionally, before GHC build system has parsec etc. set up.

@phadej
Copy link
Collaborator Author

phadej commented Jan 16, 2017

Can someone advance: haskell/hackage-security#179
I don't want to introduce CPP just to make tests compile warning free with different versions of optparse-applicative. Ping @hvr, @dcoutts, @edsko

@ezyang
Copy link
Contributor

ezyang commented Jan 16, 2017

@phadej OK, but we could plan on setting up GHC's build system to build parsec for 8.2. It will require some work but it should be within the realm of what we know how to do. So what's the plan for fixing this then?

@phadej
Copy link
Collaborator Author

phadej commented Jan 17, 2017

@ezyang To my understanding parsec-parser was planned for Cabal 2.2, which going to be bundled with GHC 8.4. Thus I wasn't in a hurry to push this forward on GHC side, I don't think it's a good idea to introduce new build dependencies at this stage. (GHC 8.2 feature freeze is end of January, i.e. this month).

@phadej
Copy link
Collaborator Author

phadej commented Jan 17, 2017

So, can I merge this, or does @ezyang object?

@23Skidoo
Copy link
Member

OK to merge IMO.

@ezyang
Copy link
Contributor

ezyang commented Jan 17, 2017

@phadej I reread the conversation, and I still don't see why cabal-install is guaranteed to get a version of Cabal with parsec enabled. To trigger the problem I'm theorizing about, try running a build with --constraint "Cabal -parsec" --constraint "cabal-install +parsec". As long as this problem exists, I don't think we should merge this patch.

Here's an alternative: export a module which is the same between the Parsec/non-enabled Parsec versions, and have cabal-install just import that. Then we are indifferent to flag selection.

@23Skidoo
Copy link
Member

23Skidoo commented Jan 17, 2017

Here's an alternative: export a module which is the same between the Parsec/non-enabled Parsec versions, and have cabal-install just import that. Then we are indifferent to flag selection.

I think that this means making Cabal always depend on Parsec, which is what we want to avoid for now.

@ezyang
Copy link
Contributor

ezyang commented Jan 17, 2017

@23Skidoo The type signature of readGenericPackageDescription is Verbosity -> FilePath -> IO GenericPackageDescription, so if it is CPP'ed between reguilar and Parsec implementations that won't leak use of Parsec.

@23Skidoo
Copy link
Member

But how will you make sure that cabal-install built with -fparsec actually uses Parsec? IMO it's better for it to fail loudly when built against wrong Cabal. This stuff has experimental status, so I think it's OK in this case.

@ezyang
Copy link
Contributor

ezyang commented Jan 17, 2017

Simple: you delete the parsec flag from cabal-install, and say "if you want to have cabal-install that parses package descriptions with Parsec, build it against a +parsec Cabal"

@23Skidoo
Copy link
Member

I'm okay with that.

@phadej
Copy link
Collaborator Author

phadej commented Jan 17, 2017

The problem is that I'd want (soon enough) to use parsec machinery to e.g. parse cabal.project. Than I cannot pretend parsec doesn't exist.

@23Skidoo
Copy link
Member

One other thing we can do here is branch 2.0 (given that GHC 8.2 will be out ~next month, I think it's time) and enable Parsec parser unconditionally in master.

@Ericson2314
Copy link
Collaborator

Ericson2314 commented Jan 18, 2017

Maybe we add a feature to require flags in libaries, and use it in post 2.0 cabal-install? [As per rust-lang/rfcs#1787 (comment) only manual flags should be allowed to change the interface.] IIRC cabal-install doesn't need to be built with old versions like Cabal, so this is OK?

@23Skidoo
Copy link
Member

@Ericson2314 See #2821 for previous discussion of that idea. Also, we can't simply set cabal-version: >= 2.2 in cabal-install.cabal in the 2.2 release, as then cabal install cabal-install will stop working with the previous version.

@Ericson2314
Copy link
Collaborator

@23Skidoo Err i mean squeeze this feature into 2.0, and then use it for 2.2.

@phadej
Copy link
Collaborator Author

phadej commented Jan 18, 2017

What if we remove flag parsec from cabal-install before making release (i.e. in 2.0 branch). Then master can be developed normally, and 2.0 cannot be built requiring Cabal with parsec enabled.

Of course you can do stupid things like --cpp-options=-DCABAL_PARSEC, but definitely you cannot do that by accident.

@ezyang
Copy link
Contributor

ezyang commented Jan 18, 2017

OK, if the motivation is starting work on cabal.project Parsec parsing, I accept that adding another flag to cabal-install is expedient. But we must clearly describe (a) how to use the flag correctly (you must also pass +parsec to Cabal), (b) what the eventual plan is (Cabal library will have Parsec unconditionally, so we can remove the flags) and (c) an issue tracking the removal of the flag.

@phadej
Copy link
Collaborator Author

phadej commented Jan 19, 2017

a) amended flag description
b) c) #4245

@ezyang
Copy link
Contributor

ezyang commented Jan 22, 2017

AppVeyor Werror fail:

Distribution\Client\Outdated.hs:137:11: warning: [-Wdeprecations]
    In the use of `readPackageDescription'
    (imported from Distribution.PackageDescription.Parse):
    Deprecated: "Use readGenericPackageDescription, old name is missleading."
<no location info>: error: 
Failing due to -Werror.

@phadej
Copy link
Collaborator Author

phadej commented Jan 22, 2017

Hmm... That's introduced by outdated patch. Trivial to fix, but won't until someone says "good to merge after CI is green" or says what's wrong otherwise. (We could start using Githubs reviews, with "accepted" / "changes requested")

@23Skidoo
Copy link
Member

From the discussion above it looks like we all agree that this is good to merge.

@phadej
Copy link
Collaborator Author

phadej commented Jan 26, 2017

Travis OS X has a bad day

@phadej phadej merged commit c621a78 into haskell:master Jan 26, 2017
@phadej phadej deleted the cabal-install-parsec-2 branch January 26, 2017 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants