Discovering breaking changes from a module interface

I was discussing with someone the following situation:

  1. I create a new feature or fix a bug in a library;
  2. I don’t think this is a breaking change, and I increment the package version accordingly;
  3. I release the new version;
  4. Users report that my new feature / bug fix WAS, in fact, a breaking change. Oops!

Does anyone here know of a tool that could compare two Haskell module interfaces, and check whether one is a breaking change from another? This could be used to:

  1. Suggest version numbers by e.g. cabal;
  2. Refuse breaking changes without appropriate versioning by Hackage
3 Likes

I believe this is one of the purposes of print-api by @Kleidukos : GitHub - Kleidukos/print-api: Dump the declarations of Haskell modules

6 Likes

Yes that’s absolutely the point of the tool, although it’s not yet perfect. :slight_smile: More users will mean better ergonomics.

@kutyel I think the Elm ecosystem has tooling that handles the version bump for you, right?

5 Likes

There was policeman: Haskell PVP version adviser but unfortunately, as so many enthusiast’s Haskell packages, a mayfly.

3 Likes

There is `cabal-diff`, a part of GitHub - phadej/cabal-extras: A tool suite to aid Haskell development using `cabal-install`

2 Likes

Yes at least for elm packages we have this:

The `elm publish` command publishes your package on <https://package.elm-lang.org> so that anyone in the Elm community can use it.

were it just goes through your types and decides whether its a major, minor or patch version, it’s kind of magical to be honest :winking_face_with_tongue:

4 Likes