[Git][ghc/ghc][wip/sand-witch/tuple-renaming-changelog] Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291)

Andrei Borzenkov (@sand-witch) gitlab at gitlab.haskell.org
Tue Jan 23 22:50:29 UTC 2024



Andrei Borzenkov pushed to branch wip/sand-witch/tuple-renaming-changelog at Glasgow Haskell Compiler / GHC


Commits:
e67fcbda by Andrei Borzenkov at 2024-01-24T02:50:11+04:00
Add changelog entry for renaming tuples from (,,...,,) to Tuple<n> (24291)

- - - - -


3 changed files:

- docs/users_guide/9.8.1-notes.rst
- libraries/base/changelog.md
- libraries/ghc-prim/changelog.md


Changes:

=====================================
docs/users_guide/9.8.1-notes.rst
=====================================
@@ -39,6 +39,26 @@ Language
 
     type instance forall j . F1 Int = Any :: j -> j
 
+- GHC proposal `#475 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst>`_
+  has been partially implemented. Namely, tuple data types, which were previously represented using a brackets-with-commas
+  syntax form ((), (,), (,,), and so on) have been renamed to common names of the form ``Unit``, ``Tuple2``, ``Tuple3``,
+  and so on, where the number after ``Tuple`` indicates its arity: ::
+
+    data Unit = ()
+
+    data Tuple2 a b = (a,b)
+    data Tuple3 a b c = (a, b, c)
+    -- and so on, up to Tuple64
+
+  For consistency, we also introduce type aliases: ::
+
+    type Tuple0 = Unit
+    type Tuple1 = Solo
+
+  The renamed tuple data types and the new type aliases can be found in the ``GHC.Tuple`` module. This renaming
+  does not break existing code that directly uses tuple data types, but it does affect tools and libraries
+  that have access to the data type names, such as ``Generic`` and Template Haskell.
+
 Compiler
 ~~~~~~~~
 


=====================================
libraries/base/changelog.md
=====================================
@@ -73,6 +73,7 @@
   * Make `Semigroup`'s `stimes` specializable. ([CLC proposal #8](https://github.com/haskell/core-libraries-committee/issues/8))
   * Implement `copyBytes`, `fillBytes`, `moveBytes` and `stimes` for `Data.Array.Byte.ByteArray` using primops ([CLC proposal #188](https://github.com/haskell/core-libraries-committee/issues/188))
   * Add rewrite rules for conversion between `Int64` / `Word64` and `Float` / `Double` on 64-bit architectures ([CLC proposal #203](https://github.com/haskell/core-libraries-committee/issues/203)).
+  * `Generic` instances for tuples now expose `Unit`, `Tuple2`, `Tuple3`, ..., `Tuple64` as the actual names for tuple type constructors ([GHC proposal #475](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst)).
 
 ## 4.18.0.0 *March 2023*
   * Shipped with GHC 9.6.1


=====================================
libraries/ghc-prim/changelog.md
=====================================
@@ -113,6 +113,10 @@
 
 - `Unit`, `Tuple0`, `Tuple1`, `Tuple2`, `Tuple3` and so on (up to `Tuple64`)
   are now exported from `GHC.Tuple.Prim` and reexported from `GHC.Tuple`.
+  GHC now uses these as the actual names for tuple data types. As a result,
+  the "brackets with commas" syntax (e.g. `()`, `(,)`, etc.) now becomes just
+  an alias to these names. This change may affect tools and libraries that
+  rely on type names, such as `Generic` and Template Haskell.
 
 ## 0.10.0
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e67fcbdacc1cf682186cddeec063bbd744e68112

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e67fcbdacc1cf682186cddeec063bbd744e68112
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240123/39a117a9/attachment-0001.html>


More information about the ghc-commits mailing list