diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-04-06 23:11:59 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-08 03:02:29 -0400 |
commit | c44432db254d2fc960d7864e080cb50e65dfa7c6 (patch) | |
tree | 7e07b12d75d38d450a0c4a134358336330dd318a | |
parent | cb1f31f5a1ad025c93f2a0b2ac57b8ec57c53ec7 (diff) | |
download | haskell-c44432db254d2fc960d7864e080cb50e65dfa7c6.tar.gz |
Fixes to 9.4 release notes
- Mention -Wforall-identifier
- Improve description of withDict
- Fix formatting
-rw-r--r-- | docs/users_guide/9.4.1-notes.rst | 24 | ||||
-rw-r--r-- | docs/users_guide/exts/primitives.rst | 4 | ||||
-rw-r--r-- | docs/users_guide/using-warnings.rst | 4 | ||||
-rw-r--r-- | libraries/ghc-prim/changelog.md | 2 |
4 files changed, 23 insertions, 11 deletions
diff --git a/docs/users_guide/9.4.1-notes.rst b/docs/users_guide/9.4.1-notes.rst index 91d866d982..cea17cac60 100644 --- a/docs/users_guide/9.4.1-notes.rst +++ b/docs/users_guide/9.4.1-notes.rst @@ -63,6 +63,9 @@ Compiler - New :ghc-flag:`-Wredundant-strictness-flags` that checks for strictness flags (``!``) applied to unlifted types, which are always strict. +- New :ghc-flag:`-Wforall-identifier` (enabled by default) that warns against + using the name ``forall`` as an identifer on the term level. + - New :ghc-flag:`-fprof-late` that adds automatic CCS annotations to all top level functions *after* core optimisation have been run. @@ -189,13 +192,19 @@ Compiler ``base`` library ~~~~~~~~~~~~~~~~ -- ``GHC.Exts.magicDict`` has been renamed to ``withDict`` and given a more - specific type: :: +- There's a new special function ``withDict`` in ``GHC.Exts``: :: withDict :: forall {rr :: RuntimeRep} st dt (r :: TYPE rr). st -> (dt => r) -> r - Unlike ``magicDict``, ``withDict`` can be used without defining an - intermediate data type. For example, the ``withTypeable`` function from the + where ``dt`` must be a class containing exactly one method, whose type + must be ``st``. + + This function converts ``st`` to a type class dictionary. + It removes the need for ``unsafeCoerce`` in implementation of reflection + libraries. It should be used with care, because it can introduce + incoherent instances. + + For example, the ``withTypeable`` function from the ``Data.Typeable`` module can now be defined as: :: withTypeable :: forall k (a :: k) rep (r :: TYPE rep). () @@ -205,6 +214,9 @@ Compiler Note that the explicit type applications are required, as the call to ``withDict`` would be ambiguous otherwise. + This replaces the old ``GHC.Exts.magicDict``, which required + an intermediate data type and was less reliable. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ @@ -255,7 +267,7 @@ Compiler ``unsafeThawSmallArray#``, ``copySmallArray#``, ``copySmallMutableArray#``, ``cloneSmallArray#``, ``cloneSmallMutableArray#``, ``freezeSmallArray#``, ``thawSmallArray#``, ``casSmallArray#``, - - ``newMutVar#``,``readMutVar#``,``writeMutV#``,``casMutVar#``, + - ``newMutVar#``, ``readMutVar#``, ``writeMutVar#``, ``casMutVar#``, - operations on ``MVar#`` and ``TVar#``: @@ -284,7 +296,7 @@ Compiler :: forall {l :: Levity} s (a :: TYPE (BoxedRep l)). SmallMutableArray# s a -> Int# -> a -> State# s -> State# s -- ``ArrayArray#` and ``MutableArrayArray#`` have been moved from ``GHC.Prim`` to ``GHC.Exts``. +- ``ArrayArray#`` and ``MutableArrayArray#`` have been moved from ``GHC.Prim`` to ``GHC.Exts``. They are deprecated, because their functionality is now subsumed by ``Array#`` and ``MutableArray#``. diff --git a/docs/users_guide/exts/primitives.rst b/docs/users_guide/exts/primitives.rst index f5107cc8b4..1a81d9ea53 100644 --- a/docs/users_guide/exts/primitives.rst +++ b/docs/users_guide/exts/primitives.rst @@ -318,7 +318,7 @@ Unlifted Newtypes Enable the use of newtypes over types with non-lifted runtime representations. GHC implements an :extension:`UnliftedNewtypes` extension as specified in -`this GHC proposal <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0013-unlifted-newtypes.rst>`_. +`the GHC proposal #98 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0098-unlifted-newtypes.rst>`_. :extension:`UnliftedNewtypes` relaxes the restrictions around what types can appear inside of a ``newtype``. For example, the type :: @@ -393,7 +393,7 @@ Unlifted Datatypes result kind. GHC implements the :extension:`UnliftedDatatypes` extension as specified in -`this GHC proposal <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0265-unlifted-data types.rst>`_. +`the GHC proposal #265 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0265-unlifted-datatypes.rst>`_. :extension:`UnliftedDatatypes` relaxes the restrictions around what result kinds are allowed in data declarations. For example, the type :: diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index 60598eb623..977bb69941 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -1498,8 +1498,8 @@ of ``-W(no-)*``. The use of ``*`` to denote the kind of inhabited types relies on the :extension:`StarIsType` extension, which in a future release will be turned off by default and then possibly removed. The reasons for this and - the deprecation schedule are described in `GHC proposal #30 - <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0030-remove-star-kind.rst>`__. + the deprecation schedule are described in `GHC proposal #143 + <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0143-remove-star-kind.rst>`__. This warning allows to detect such uses of ``*`` before the actual breaking change takes place. The recommended fix is to replace ``*`` with diff --git a/libraries/ghc-prim/changelog.md b/libraries/ghc-prim/changelog.md index 0485c633af..45701629a4 100644 --- a/libraries/ghc-prim/changelog.md +++ b/libraries/ghc-prim/changelog.md @@ -75,7 +75,7 @@ `unsafeThawSmallArray#`, `copySmallArray#`, `copySmallMutableArray#`, `cloneSmallArray#`, `cloneSmallMutableArray#`, `freezeSmallArray#`, `thawSmallArray#`, `casSmallArray#`, - - `newMutVar#`,`readMutVar#`,`writeMutV#`,`casMutVar#`, + - `newMutVar#`, `readMutVar#`, `writeMutVar#`,`casMutVar#`, - operations on `MVar#` and `TVar#`: |