dhall-lang / dhall-to-cabal

Compile Dhall expressions to Cabal files
MIT License
100 stars 19 forks source link

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

Open jneira opened 6 years ago

jneira commented 6 years ago

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:

Thanks!

ocharles commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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`