%
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[HsLit]{Abstract syntax: source-language literals}
\begin{code}
data HsLit
- = HsChar Char -- characters
- | HsCharPrim Char -- unboxed char literals
+ = HsChar Int -- characters
+ | HsCharPrim Int -- unboxed char literals
| HsString FAST_STRING -- strings
| HsStringPrim FAST_STRING -- packed string
\begin{code}
instance Outputable HsLit where
- ppr (HsChar c) = text (show c)
- ppr (HsCharPrim c) = (<>) (text (show c)) (char '#')
- ppr (HsString s) = text (show s)
- ppr (HsStringPrim s) = (<>) (text (show s)) (char '#')
+ -- Use "show" because it puts in appropriate escapes
+ ppr (HsChar c) = pprHsChar c
+ ppr (HsCharPrim c) = pprHsChar c <> char '#'
+ ppr (HsString s) = pprHsString s
+ ppr (HsStringPrim s) = pprHsString s <> char '#'
ppr (HsInt i) = integer i
ppr (HsFrac f) = rational f
- ppr (HsFloatPrim f) = (<>) (rational f) (char '#')
- ppr (HsDoublePrim d) = (<>) (rational d) (text "##")
- ppr (HsIntPrim i) = (<>) (integer i) (char '#')
+ ppr (HsFloatPrim f) = rational f <> char '#'
+ ppr (HsDoublePrim d) = rational d <> text "##"
+ ppr (HsIntPrim i) = integer i <> char '#'
ppr (HsLitLit s) = hcat [text "``", ptext s, text "''"]
\end{code}