summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-01-11 10:42:17 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-11 19:42:07 -0500
commit34d8bc24e33aa373acb6fdeef51427d968f28c0c (patch)
tree4eb89724f1b4e9e24ac3dc315497a5071ef463ef /compiler/GHC/Driver
parentaddf8e544841a3f7c818331e47fa89a2cbfb7b29 (diff)
downloadhaskell-34d8bc24e33aa373acb6fdeef51427d968f28c0c.tar.gz
Fix parsing & printing of unboxed sums
The pretty-printing of partially applied unboxed sums was incorrect, as we incorrectly dropped the first half of the arguments, even for a partial application such as (# | #) @IntRep @DoubleRep Int# which lead to the nonsensical (# DoubleRep | Int# #). This patch also allows users to write unboxed sum type constructors such as (# | #) :: TYPE r1 -> TYPE r2 -> TYPE (SumRep '[r1,r2]). Fixes #20858 and #20859.
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r--compiler/GHC/Driver/Session.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index b0b37a822c..780a38e3d7 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -3851,6 +3851,10 @@ impliedXFlags
, (LangExt.TemplateHaskell, turnOn, LangExt.TemplateHaskellQuotes)
, (LangExt.Strict, turnOn, LangExt.StrictData)
+ -- Historically only UnboxedTuples was required for unboxed sums to work.
+ -- To avoid breaking code, we make UnboxedTuples imply UnboxedSums.
+ , (LangExt.UnboxedTuples, turnOn, LangExt.UnboxedSums)
+
-- The extensions needed to declare an H98 unlifted data type
, (LangExt.UnliftedDatatypes, turnOn, LangExt.DataKinds)
, (LangExt.UnliftedDatatypes, turnOn, LangExt.StandaloneKindSignatures)