Skip to content

2.0 migration guide

Erik de Castro Lopo edited this page May 1, 2017 · 6 revisions

Cabal 2.0 comes with a number of backwards-compatibility breaking changes. This page documents some of them and gives advice on how to adjust your code for the new APIs. When possible, we will give guidance on how to write your code in a way that is simultaneously compatible with 2.0 and earlier versions, but in many cases you will have to use CPP to handle the differences.

Newly opaque data types

The following data types are now opaque (in order to support a more efficient underlying representation):

  • PackageName
  • FlagName
  • AbiHash
  • Version

To construct these types, use mkXXXXX; to destruct them, use unXXXXX. These types can also be converted back into strings using display, which is backwards compatible with old versions of Cabal.

Changed data types

  • GenericPackageDescription used to have fields condExecutables, condTestSuites and condBenchmarks of type [(String, CondTree ConfVar [Dependency] x)]. The String field is now has type UnqualComponentName.

Deprecated functions

  • readPackageDescription (from Distribution.PackageDescription.Parse) is deprecated in favor of readGenericPackageDescription.