Upgrading Stack to Cabal 2.2

Michael Snoyman michael at snoyman.com
Tue Feb 20 13:47:37 UTC 2018


Hi all,

Oleg mentioned to me on Reddit that a 2.2 branch has been cut for Cabal,
and recommended we try to upgrade Stack to it. I'm sharing information here
on that process in case it's useful to others, either as feedback on the
API changes, or help for others going through similar upgrades. If anyone
would rather that I do or do not post such reports in the future, let me
know.

I've opened a PR for this change[1], which currently is a single commit[2].
As you can see from the change to stack.yaml[3], I needed to refer to the
commit of Cabal in question, and turn on `allow-newer` for some packages
(cabal-doctest and http-api-data) with restrictive upper bounds on Cabal.
Both of these packages compiled without issue.

No change was necessary to Stack's Setup.hs file.

Most of the changes so far were compile-time errors, which is a Good Thing.
Changes I had to make:

* The build type is no longer a Maybe field. (As a user: this is a nice
change, no longer a need to guess about what a Nothing value means.)
* There are now two License types, the original one and the SPDX variant. I
don't understand what this change is about, some further explanation in the
docs or the ChangeLog would definitely be appreciated. But hacking my way
through the types seems to have worked.
* Parsing a package description now works on a ByteString instead of a
String. This allowed me to remove some UTF8 conversion and BOM-stripping
code, which is very nice.
* The new parsing API exposes the cabal file version when that prevented
the parse (at least, that's my understanding). The changes to accommodate
the new API were relatively trivial, so another +1 here.
* Also: getting file position information for warnings and errors is _very_
nice. +1

I haven't done extensive testing yet, but I've so far only found one bug
due to runtime changes: the behavior of allBuildInfo has changed to now
include non-buildable components. This resulted in some confusion until I
reviewed the changelog more closely. If I could make a request, it would be
that, in the future, new runtime behavior come with a new function name, to
convert runtime errors into compile time errors. This was _not_ a
particularly difficult issue to work around though, in large part thanks to
the changelog.

I'll continue testing this branch of Stack. Our plans are to merge this to
master, and release Stack 1.7.0 close to the Cabal 2.2 release date.

Michael

[1] https://github.com/commercialhaskell/stack/pull/3878/files
[2]
https://github.com/commercialhaskell/stack/pull/3878/commits/a101341d04213d6dd8e0cf16d2f2fef8e7ed5cd5
[3]
https://github.com/commercialhaskell/stack/pull/3878/commits/a101341d04213d6dd8e0cf16d2f2fef8e7ed5cd5#diff-fafd0cdcd559a7b124cc61c29413fb54
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/cabal-devel/attachments/20180220/da5e7163/attachment.html>


More information about the cabal-devel mailing list