Skip to content

Commit 3e1cc44

Browse files
committed
Start rewrite in rfc2119 -style
1 parent 3acb0e8 commit 3e1cc44

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

pvp-specification.md

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -40,54 +40,61 @@ ordering of the components. For example, 2.0.1 \> 1.3.2, and 2.0.1.0 \> 2.0.1.
4040
version number. When a package is updated, the following rules govern
4141
how the version number must change relative to the previous version:
4242

43-
1. If any entity was removed, or the types of any entities or the
44-
definitions of datatypes or classes were changed, or [orphan
45-
instances](https://wiki.haskell.org/Orphan_instance) were added or any
46-
instances were removed, then the new *A.B* must be greater than the previous
47-
*A.B*. Note that modifying imports or depending on a newer version of another
48-
package may cause extra orphan instances to be exported and thus force a major
49-
version change.
50-
2. Otherwise, if only new bindings, types, classes, non-orphan
51-
instances or modules (but see below) were added to the interface,
52-
then *A.B* may remain the same but the new *C* must be greater than
53-
the old *C*. Note that modifying imports or depending on a newer
54-
version of another package may cause extra non-orphan instances to
55-
be exported and thus force a minor version change.
56-
3. Otherwise, *A.B.C* may remain the same (other version components may
57-
change).
58-
59-
Hence *A.B.C* uniquely identifies the API. A client that wants to
60-
specify that they depend on a particular version of the API can specify
61-
a particular *A.B.C* and be sure of getting that API only. For example,
43+
The key words "MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
44+
“SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be
45+
interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119).
46+
47+
1. *Breaking change*. If any entity was removed, or the types of any entities
48+
or the definitions of datatypes or classes were changed, or orphan instances
49+
were added or any instances were removed, then the new *A.B* **MUST** be
50+
greater than the previous *A.B*. Note that modifying imports or depending on a
51+
newer version of another package may cause extra orphan instances to be
52+
exported and thus force a major version change.
53+
54+
1. *Non-breaking change*. Otherwise, if only new bindings, types, classes,
55+
non-orphan instances or modules (but see below) were added to the interface,
56+
then *A.B* **MAY** remain the same but the new *C* **MUST** be greater than the
57+
old *C*. Note that modifying imports or depending on a newer version of another
58+
package may cause extra non-orphan instances to be exported and thus force a
59+
minor version change.
60+
61+
1. *Other changes*. Otherwise, e.g. if change consist only of corrected
62+
documentation, non-visible change to allow different dependency range etc.
63+
*A.B.C* **MAY** remain the same (other version components may change).
64+
65+
1. *Client specification*. Hence *A.B.C* uniquely identifies the API. A client
66+
that wants to specify that they depend on a particular version of the API can
67+
specify a particular *A.B.C* and be sure of getting that API only. For example,
6268
`build-depends: mypkg >= 2.1.1 && < 2.1.2`.
6369

64-
Often a package maintainer wants to add to an API without breaking
65-
backwards compatibility, and in that case they can follow the rules of
66-
point 2, and increase only *C*. A client can specify that they are
67-
[insensitive to additions to the API](https://wiki.haskell.org/Import_modules_properly)
68-
by allowing a range of *C* values, e.g. `build-depends: base >= 2.1.1 && < 2.2`.
70+
1. *Backwards compatible client specification*. Often a package maintainer
71+
wants to add to an API without breaking backwards compatibility, and in that
72+
case they can follow the rules of point 2, and increase only *C*. A client
73+
**MAY** specify that they are [insensitive to additions to the
74+
API](https://wiki.haskell.org/Import_modules_properly) by allowing a range of
75+
*C* values, e.g. `build-depends: base >= 2.1.1 && < 2.2`.
6976

70-
If a package defines an orphan instance, it must depend on the minor
71-
version of the packages that define the data type and the type class to
72-
be backwards compatible. For example,
77+
1. *Client defines orphan instance*. If a package defines an orphan instance,
78+
it **MUST** depend on the minor version of the packages that define the data
79+
type and the type class to be backwards compatible. For example,
7380
`build-depends: mypkg >= 2.1.1 && < 2.1.2`.
7481

75-
### Deprecation
76-
77-
Deprecated entities (via [a `DEPRECATED`
78-
pragma](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#warning-and-deprecated-pragmas))
79-
should probably be counted as removed for the purposes of upgrading the API,
80-
because packages that use `-Werror` will be broken by the deprecation.
81-
82-
### Adding new modules
83-
84-
Adding new modules might cause an unavoidable name collision in
85-
dependent code. However, this is usually pretty unlikely, especially if
86-
you keep to your own namespace, so only an increase of the minor version
87-
number is required. If, however, your added module name is taken from
88-
another package (e.g. when `network-bytestring` was merged into
89-
`network`) or is quite general (`Data.Set` or something similar) then
90-
the version increase should be major.
82+
1. *Deprecation*. Deprecated entities (via a `DEPRECATED` pragma) *SHOULD* be
83+
counted as removed for the purposes of upgrading the API, because packages that
84+
use `-Werror` will be broken by the deprecation. In other words the new *A.B*
85+
**SHOULD** be greater than the previous *A.B*.
86+
87+
1. *Adding new modules*. Adding new modules might cause an unavoidable name
88+
collision in dependent code. However, this is usually pretty unlikely,
89+
especially if you keep to your own namespace, so only an increase of the minor
90+
version number is required, in other words *A.B* **MAY** remain the same the
91+
new *C* **MUST** be greater than the old *C*. If, however, your added module
92+
name is taken from another package (e.g. when `network-bytestring` was merged
93+
into `network`) or is quite general (`Data.Set` or something similar) then the
94+
version increase **SHOULD** be major.
95+
96+
Special situations
97+
------------------
9198

9299
### Leaking instances
93100

0 commit comments

Comments
 (0)