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

Add support for cabal-version field values in the form ">= 1.10" #37

Open
jneira opened this issue Apr 28, 2018 · 4 comments
Open

Add support for cabal-version field values in the form ">= 1.10" #37

jneira opened this issue Apr 28, 2018 · 4 comments

Comments

@jneira
Copy link
Collaborator

jneira commented Apr 28, 2018

Hi, it seems dhall-to-cabal dont support the >= 1.10 value in the field, only a simple version like 2.0.
However cabal files referencing cabal specs below 1.12 must use the form >= 1.10. Although packages should update those versions i guess there are many of them using it yet.
Not sure about how to implement it in dhall-to-cabal and cabal-to-dhall:

  • an option could change the dhall type of cabal-version to < Left : ./Version.dhall | Right : ./VersionRange.dhall >
    • like the cabal lib underlying type specVersionRaw :: Either Version VersionRange
    • but in fact cabal only allow simple versions or >= 1.10

Thanks!

@ocharles
Copy link
Member

Hi. You're right, dhall-to-cabal only takes inputs where the cabal version is exactly specified. I've done this because of this comment:

The version of the Cabal spec that this package description uses. For historical reasons this is specified with a version range but only ranges of the form >= v make sense. We are in the process of transitioning to specifying just a single version, not a range. See also specVersion.

This is on specVersionRaw here.

Before we look at solutions, I haven't entirely understand why this constraint is causing a problem. Could you elaborate as to why you need >= 1.10?

@quasicomputational
Copy link
Collaborator

I think the problem is that old Cabal spec versions do strictly require the >= (i.e., writing cabal-vesion: 1.10 won't work). But it probably makes more sense to have a check for being less than 1.10 and inserting the >= in that case unconditionally anyway, and not otherwise, rather than leaving it up to the user.

@ocharles
Copy link
Member

I'm not entirely sure it's in the remit of dhall-to-cabal to do that validation (there are various ways you can construct a Cabal file that parses, but isn't accepted by cabal semantically). That said, adding the >= seems reasonable.

@jneira
Copy link
Collaborator Author

jneira commented Apr 30, 2018

  • For completeness, this is the warning from cabal check with cabal-version = 1.10:
PS C:\dhall\dhall-to-cabal> cabal --version
cabal-install version 2.2.0.0
compiled using version 2.2.0.1 of the Cabal library
PS C:\dhall\dhall-to-cabal> type .\dhall-to-cabal.cabal | sls "cab
al-version"
cabal-version: 1.10
PS C:\dhall\dhall-to-cabal> cabal check
The following warnings are likely to affect your build negatively:
* With Cabal 1.10 or earlier, the 'cabal-version' field must use range syntax
rather than a simple version number. Use 'cabal-version: >= 1.10'.

Hackage would reject this package.

Although it is a warning the last sentence sounds really bad 😉

Moreover, cabal-to-dhall does not support cabal files with cabal-version: >= 1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants