diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-10-27 14:19:59 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-05 05:30:48 -0400 |
commit | 59dfb00584e6d24d82d3f5338c6299bae48e0468 (patch) | |
tree | f538e7287a05e37ae26a7cf9abb9a6087e1371f2 /libraries/ghc-prim | |
parent | f0b920d1613db43925c01f02b0f550e29b11a86b (diff) | |
download | haskell-59dfb00584e6d24d82d3f5338c6299bae48e0468.tar.gz |
Remove record field from Solo
Ticket #20562 revealed that Solo, which is a wired-in TyCon, had
a record field that wasn't being added to the type env. Why not?
Because wired-in TyCons don't have record fields.
It's not hard to change that, but it's tiresome for this one use-case,
and it seems easier simply to make `getSolo` into a standalone
function.
On the way I refactored the handling of Solo slightly, to put it
into wiredInTyCons (where it belongs) rather than only in
knownKeyNames
Diffstat (limited to 'libraries/ghc-prim')
-rw-r--r-- | libraries/ghc-prim/GHC/Tuple.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libraries/ghc-prim/GHC/Tuple.hs b/libraries/ghc-prim/GHC/Tuple.hs index 9254ab72ae..9f4b70e6c1 100644 --- a/libraries/ghc-prim/GHC/Tuple.hs +++ b/libraries/ghc-prim/GHC/Tuple.hs @@ -77,7 +77,15 @@ data () = () -- unary tuples, they can also be useful for fine-grained control of -- strict-spined data structure traversals, and for unifying the -- implementations of lazy and strict mapping functions. -data Solo a = Solo { getSolo :: a } +data Solo a = Solo a + +getSolo :: Solo a -> a +-- getSolo is a standalone function, rather than a record field of Solo, +-- because Solo is a wired-in TyCon, and a wired-in TyCon that has +-- record fields is a bit more inconvenient than if it doesn't. +-- (No other wired-in TyCon has record fields.) So it seems easier +-- to have getSolo as its own separate function (#20562) +getSolo (Solo a) = a data (a,b) = (a,b) data (a,b,c) = (a,b,c) |