summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Winograd-Cort <dwincort@gmail.com>2021-03-07 10:53:29 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-08 07:32:53 -0500
commite483775c3ff39523d18c44f04b4842518437fba8 (patch)
treec821936346eec0bad642f6ec49c9cd7a2a496fc2
parente145e44ce6de3afd07932f328c5efadb941f08aa (diff)
downloadhaskell-e483775c3ff39523d18c44f04b4842518437fba8.tar.gz
Update changelog and release notes for Data.Type.Ord change
-rw-r--r--docs/users_guide/9.2.1-notes.rst24
-rw-r--r--libraries/base/changelog.md8
2 files changed, 32 insertions, 0 deletions
diff --git a/docs/users_guide/9.2.1-notes.rst b/docs/users_guide/9.2.1-notes.rst
index 183097048e..515dd4bbb2 100644
--- a/docs/users_guide/9.2.1-notes.rst
+++ b/docs/users_guide/9.2.1-notes.rst
@@ -234,6 +234,30 @@ Eventlog
charVal :: forall n proxy. KnownChar n => proxy n -> Char
charVal' :: forall n. KnownChar n => Proxy# n -> Char
+- A new kind-polymorphic ``Compare`` type family was added in ``Data.Type.Ord``
+ and has type instances for ``Nat``, ``Symbol``, and ``Char``. Furthermore,
+ the ``(<=?)`` type (and ``(<=)``) from ``GHC.TypeNats`` is now governed by
+ this type family (as well as new comparison type operators that are exported
+ by ``Data.Type.Ord``). This has two important repercussions. First, GHC can
+ no longer deduce that all natural numbers are greater than or equal to zero.
+ For instance, ::
+
+ test1 :: Proxy (0 <=? x) -> Proxy True
+ test1 = id
+
+ which previously type checked will now result in a type error. Second, when
+ these comparison type operators are used very generically, a kind may need to
+ be provided. For example, ::
+
+ test2 :: Proxy (x <=? x) -> Proxy True
+ test2 = id
+
+ will now generate a type error because GHC does not know the kind of ``x``.
+ To fix this, one must provide an explicit kind, perhaps by changing the type
+ to: ::
+
+ test2 :: forall (x :: Nat). Proxy (x <=? x) -> Proxy True
+
- On POSIX, ``System.IO.openFile`` can no longer leak a file descriptor if it
is interrupted by an asynchronous exception (#19114, #19115).
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index cc0100e585..7900c9aad5 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -8,6 +8,14 @@
in order to define instances for `Nat`. Also, different instances for `Nat` and `Natural`
won't typecheck anymore.
+ * Add `Data.Type.Ord` as a module for type-level comparison operations. The
+ `(<=?)` type operator from `GHC.TypeNats`, previously kind-specific to
+ `Nat`, is now kind-polymorphic and governed by the `Compare` type family in
+ `Data.Type.Ord`. Note that this means GHC will no longer deduce `0 <= n`
+ for all `n` any more.
+
+ * Add `cmpNat`, `cmpSymbol`, and `cmpChar` to `GHC.TypeNats` and `GHC.TypeLits`.
+
* Add `Semigroup` and `Monoid` instances for `Data.Functor.Product` and
`Data.Functor.Compose`.