9898 For large projects with many packages, it would be a lot of work to keep all
9999package dependency version ranges up to date if each package was independently
100100maintained, especially using tight version ranges for dependencies in the
101- packages. Here are some options for avoiding or setting the same version ranges
102- in each package of a project with many packages:
101+ packages. For a dependency, we can avoid setting its version range in any
102+ package, or we can set the same version range in each package of a project.
103103
104104**Avoiding **
105105 Package-level version ranges can be avoided;
106106
107- - by using a curated set of packages and versions and import these into the project , or
107+ - by using a curated set of packages and versions, or
108108 - by specifying version constraints only in the ``cabal.project ``.
109109
110+ Curated sets of version constrained packages, such as the ones supplied by
111+ Stackage, are project-level configuration, ready-made to be imported by a
112+ project.
113+
110114**Setting **
111115 Package-level version ranges can be specified in one place and then copied
112116 to packages;
@@ -115,6 +119,17 @@ in each package of a project with many packages:
115119 - by using a package formatter with fragment pragmas, or
116120 - by using a bash script to replace or update version ranges in all package descriptions.
117121
122+ If a project has many packages and these are all in-house and not published,
123+ then it will be easier to use the same version range for a dependency
124+ everywhere. When only some packages of a project are published, and moreover
125+ when their publication times are staggered, it may not be possible to use the
126+ same version range for a dependency in all packages of a project. In this latter
127+ case we'll need to adjust the avoidance and shared setting techniques. A
128+ project-level version range for a dependency will still work as long as it lies
129+ within (as long as it narrows) each package-level version range for the same
130+ dependency. For package-level generators, formatters or scripts, you may need
131+ to use more than one set of imports, fragment pragmas or scripts.
132+
118133.. _version-constraints :
119134
120135Version constraints
0 commit comments