summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Outputable.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-10-12 18:43:46 +0200
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-12-30 15:30:19 +0000
commit84cd0051d14752eb8f6b94f2e3b02706cba42742 (patch)
treeca5e6dad1b53a3982a2644cdc132b22408b55aff /compiler/GHC/Utils/Outputable.hs
parentcbc7c3dda6bdf4acb760ca9eb545faeb98ab0dbe (diff)
downloadhaskell-wip/fixed-width-lits.tar.gz
Make proper fixed-width number literalswip/fixed-width-lits
(Progress towards #11953, #17377, #17375) Besides being nicer to use, this also will allow for better constant folding for the fixed-width types, on par with what `Int#` and `Word#` have today.
Diffstat (limited to 'compiler/GHC/Utils/Outputable.hs')
-rw-r--r--compiler/GHC/Utils/Outputable.hs36
1 files changed, 23 insertions, 13 deletions
diff --git a/compiler/GHC/Utils/Outputable.hs b/compiler/GHC/Utils/Outputable.hs
index ecef33ae86..d26365ad77 100644
--- a/compiler/GHC/Utils/Outputable.hs
+++ b/compiler/GHC/Utils/Outputable.hs
@@ -59,12 +59,18 @@ module GHC.Utils.Outputable (
pprInfixVar, pprPrefixVar,
pprHsChar, pprHsString, pprHsBytes,
- primFloatSuffix, primCharSuffix, primWordSuffix, primDoubleSuffix,
- primInt64Suffix, primWord64Suffix, primIntSuffix,
+ primFloatSuffix, primCharSuffix, primDoubleSuffix,
+ primInt8Suffix, primWord8Suffix,
+ primInt16Suffix, primWord16Suffix,
+ primInt32Suffix, primWord32Suffix,
+ primInt64Suffix, primWord64Suffix,
+ primIntSuffix, primWordSuffix,
pprPrimChar, pprPrimInt, pprPrimWord,
- pprPrimInt8, pprPrimInt16, pprPrimInt32, pprPrimInt64,
- pprPrimWord8, pprPrimWord16, pprPrimWord32, pprPrimWord64,
+ pprPrimInt8, pprPrimWord8,
+ pprPrimInt16, pprPrimWord16,
+ pprPrimInt32, pprPrimWord32,
+ pprPrimInt64, pprPrimWord64,
pprFastFilePath, pprFilePathString,
@@ -1154,12 +1160,13 @@ pprHsBytes bs = let escaped = concatMap escape $ BS.unpack bs
-- Postfix modifiers for unboxed literals.
-- See Note [Printing of literals in Core] in "GHC.Types.Literal".
-primCharSuffix, primFloatSuffix, primIntSuffix :: SDoc
-primDoubleSuffix, primWordSuffix :: SDoc
-primInt8Suffix, primWord8Suffix :: SDoc
-primInt16Suffix, primWord16Suffix :: SDoc
-primInt32Suffix, primWord32Suffix :: SDoc
-primInt64Suffix, primWord64Suffix :: SDoc
+primCharSuffix, primFloatSuffix, primDoubleSuffix,
+ primIntSuffix, primWordSuffix,
+ primInt8Suffix, primWord8Suffix,
+ primInt16Suffix, primWord16Suffix,
+ primInt32Suffix, primWord32Suffix,
+ primInt64Suffix, primWord64Suffix
+ :: SDoc
primCharSuffix = char '#'
primFloatSuffix = char '#'
primIntSuffix = char '#'
@@ -1176,9 +1183,12 @@ primWord64Suffix = text "##64"
-- | Special combinator for showing unboxed literals.
pprPrimChar :: Char -> SDoc
-pprPrimInt, pprPrimWord :: Integer -> SDoc
-pprPrimInt8, pprPrimInt16, pprPrimInt32, pprPrimInt64 :: Integer -> SDoc
-pprPrimWord8, pprPrimWord16, pprPrimWord32, pprPrimWord64 :: Integer -> SDoc
+pprPrimInt, pprPrimWord,
+ pprPrimInt8, pprPrimWord8,
+ pprPrimInt16, pprPrimWord16,
+ pprPrimInt32, pprPrimWord32,
+ pprPrimInt64, pprPrimWord64
+ :: Integer -> SDoc
pprPrimChar c = pprHsChar c <> primCharSuffix
pprPrimInt i = integer i <> primIntSuffix
pprPrimWord w = word w <> primWordSuffix