Does adding a data constructor require a major version bump according to the PVP?

Non-exhaustive pattern matches is not a compilation error by default in GHC. Only if you compile with -Werror, otherwise it’s just a warning. PVP addresses only compile-time compatibility, i.e. bounds should result in a buildable project (not necessary working correctly in runtime).

However, there’s this clause:

  1. Deprecation. Deprecated entities (via a DEPRECATED pragma) SHOULD be counted as removed for the purposes of upgrading the API, because packages that use -Werror will be broken by the deprecation. In other words the new A.B SHOULD be greater than the previous A.B.

This means that PVP actually cares about -Werror being enabled even though it’s written in vague words.

But even without that clause, I’d still bump up a major version after adding a new constructor. Some functions can pattern match on all constructors and they may throw runtime error with the new version of the package with a new constructor. You may want to change the code to address this problem.

In my vision, minor versions could be upgraded automatically and it should be always safe to upgrade a minor version without any code changes. But upgrading to a newer major version may require some code changes and this action should be explicit.

7 Likes