summaryrefslogtreecommitdiff
path: root/compiler/hsSyn/HsLit.hs
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-03-03 07:21:32 -0600
committerAustin Seipp <austin@well-typed.com>2015-03-03 07:21:33 -0600
commit89458eba5721de1b6b3378415f26e110bab8cc0f (patch)
tree9bdcb564437e6053e1f490cd1892f4df0de9736b /compiler/hsSyn/HsLit.hs
parent5200bdeb26c5ec98739b14b10fc8907296bceeb9 (diff)
downloadhaskell-89458eba5721de1b6b3378415f26e110bab8cc0f.tar.gz
Pretty-print # on unboxed literals in core
Summary: Ticket #10104 dealt with showing the '#'s on types with unboxed fields. This commit pretty prints the '#'s on unboxed literals in core output. Test Plan: simplCore/should_compile/T8274 Reviewers: jstolarek, simonpj, austin Reviewed By: simonpj, austin Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D678 GHC Trac Issues: #8274
Diffstat (limited to 'compiler/hsSyn/HsLit.hs')
-rw-r--r--compiler/hsSyn/HsLit.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/hsSyn/HsLit.hs b/compiler/hsSyn/HsLit.hs
index 2a910ad86b..a53c67c103 100644
--- a/compiler/hsSyn/HsLit.hs
+++ b/compiler/hsSyn/HsLit.hs
@@ -151,20 +151,19 @@ instance Ord OverLitVal where
compare (HsIsString _ _) (HsFractional _) = GT
instance Outputable HsLit where
- -- Use "show" because it puts in appropriate escapes
ppr (HsChar _ c) = pprHsChar c
- ppr (HsCharPrim _ c) = pprHsChar c <> char '#'
+ ppr (HsCharPrim _ c) = pprPrimChar c
ppr (HsString _ s) = pprHsString s
- ppr (HsStringPrim _ s) = pprHsBytes s <> char '#'
+ ppr (HsStringPrim _ s) = pprHsBytes s
ppr (HsInt _ i) = integer i
ppr (HsInteger _ i _) = integer i
ppr (HsRat f _) = ppr f
- ppr (HsFloatPrim f) = ppr f <> char '#'
- ppr (HsDoublePrim d) = ppr d <> text "##"
- ppr (HsIntPrim _ i) = integer i <> char '#'
- ppr (HsWordPrim _ w) = integer w <> text "##"
- ppr (HsInt64Prim _ i) = integer i <> text "L#"
- ppr (HsWord64Prim _ w) = integer w <> text "L##"
+ ppr (HsFloatPrim f) = ppr f <> primFloatSuffix
+ ppr (HsDoublePrim d) = ppr d <> primDoubleSuffix
+ ppr (HsIntPrim _ i) = pprPrimInt i
+ ppr (HsWordPrim _ w) = pprPrimWord w
+ ppr (HsInt64Prim _ i) = pprPrimInt64 i
+ ppr (HsWord64Prim _ w) = pprPrimWord64 w
-- in debug mode, print the expression that it's resolved to, too
instance OutputableBndr id => Outputable (HsOverLit id) where