dhall-lang / dhall-to-cabal

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

Change the default build-type to omission and cabal-version to 2.2 #98

Closed quasicomputational closed 6 years ago

quasicomputational commented 6 years ago

In Cabal 2.2, build-type inference works for 99% of cases and it is pretty nice. However, if we have a specified default build-type, there's no good way to get at that niceness from dhall-to-cabal: if you're having to manually over-ride the default, you might as well explicitly specify it!

Further, so that users will be able to write this common case with a minimum of boilerplace, the default cabal-version has been bumped to 2.2.

This also brings us into alignment with Cabal 2.2's default build-type, which is Nothing.

quasicomputational commented 6 years ago

I should also note that this is something we want to do anyway, no matter which of #83 or #88 wins out: as outlined in the commit message it's better ergonomics, and it also matches Cabal's default so it fits with #88 nicely.

quasicomputational commented 6 years ago

Hmm. The rabbit hole goes deeper. It turns out that it's easy to generate invalid .cabal files for cabal-version: 2.2, because non-SPDX licenses aren't at all supported, and pre-2.2 spec versions will fail with SPDX. So, if we want to follow the dictum of 'make illegal states unrepresentable', we should change the Package type to be a union of pre-2.2 and post-2.2 records, or do something similar.

That's a bigger issue than this PR, which I still think is a good idea. I'll change the default license to something that actually works.

quasicomputational commented 6 years ago

Ugh. And Cabal reads a cabal-version: 2.0 file without a license as being SPDX.NONE, so I can't get away from special-casing.

quasicomputational commented 6 years ago

The license stuff is #99. It's hackish but any solution was going to be a hack. Once that's merged I'll rebase this and, hopefully, this is unblocked.

ocharles commented 6 years ago

Ready to rebase!

ocharles commented 6 years ago

Seem to have some test failures now - I think possibly because the Cabal version is too old. Should we update to Cabal 2.2? Seems like we are now only compatible with Cabal 2.2 though.

quasicomputational commented 6 years ago

Huh, we should be 2.2-only, yeah. I think maybe I broke something; I'll have a look.

ocharles commented 6 years ago

No, I don't think you broke anything, I just need to regenerate Nix expressions. I'll do that now.

ocharles commented 6 years ago

Hmm, no - actually it looks like we're already using Cabal 2.2. So it could be that something is now broken.

Configuring dhall-to-cabal-1.1.0.0...
Dependency Cabal ==2.2.*: using Cabal-2.2.0.1
quasicomputational commented 6 years ago

Think I just got the rebase wrong. Just making sure the tests pass locally before I push again.