summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-05-26 15:24:53 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-05-26 15:24:53 +0100
commite9e61f18a548b70693f4ccd245bc56335c94b498 (patch)
tree435656be2c2523687e46836814cffb8cd1d613f9 /compiler/prelude
parent0f1e315b9274725c4a2c975f4d06a5c956cf5385 (diff)
downloadhaskell-e9e61f18a548b70693f4ccd245bc56335c94b498.tar.gz
Reduce special-casing for nullary unboxed tuple
When we built the kind of a nullary unboxed tuple, we said, in TysWiredIn.mk_tuple: res_rep | arity == 0 = voidRepDataConTy -- See Note [Nullary unboxed tuple] in Type | otherwise = unboxedTupleRepDataConTy But this is bogus. The Note deals with what the 'unarise' transformation does, and up to that point it's simpler and more uniform to treat nullary unboxed tuples the same as all the others. Nicer now. And it fixes the Lint error in Trac #12115
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/TysWiredIn.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 6fbb8212f5..5613d86749 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -73,7 +73,7 @@ module TysWiredIn (
-- * Kinds
typeNatKindCon, typeNatKind, typeSymbolKindCon, typeSymbolKind,
isLiftedTypeKindTyConName, liftedTypeKind, constraintKind,
- starKindTyCon, starKindTyConName,
+ starKindTyCon, starKindTyConName, unboxedTupleKind,
unicodeStarKindTyCon, unicodeStarKindTyConName,
liftedTypeKindTyCon, constraintKindTyCon,
@@ -546,10 +546,10 @@ constraintKindTyCon :: TyCon
constraintKindTyCon = pcTyCon False NonRecursive constraintKindTyConName
Nothing [] []
-liftedTypeKind, constraintKind :: Kind
+liftedTypeKind, constraintKind, unboxedTupleKind :: Kind
liftedTypeKind = tYPE ptrRepLiftedTy
constraintKind = mkTyConApp constraintKindTyCon []
-
+unboxedTupleKind = tYPE unboxedTupleRepDataConTy
{-
************************************************************************
@@ -755,15 +755,12 @@ mk_tuple boxity arity = (tycon, tuple_con)
-- NB: This must be one call to mkTemplateTyVars, to make
-- sure that all the uniques are different
(rr_tvs, open_tvs) = splitAt arity all_tvs
- res_rep | arity == 0 = voidRepDataConTy
- -- See Note [Nullary unboxed tuple] in Type
- | otherwise = unboxedTupleRepDataConTy
in
( UnboxedTuple
, gHC_PRIM
, mkNamedBinders Specified rr_tvs ++
map (mkAnonBinder . tyVarKind) open_tvs
- , tYPE res_rep
+ , unboxedTupleKind
, arity * 2
, all_tvs
, mkTyVarTys open_tvs