%
-% (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}
-#include "HsVersions.h"
-
module HsBasic where
-IMP_Ubiq(){-uitous-}
-
-IMPORT_1_3(Ratio(Rational))
+#include "HsVersions.h"
-import Pretty
import Outputable
+import Ratio ( Rational )
\end{code}
%************************************************************************
\begin{code}
instance Outputable HsLit where
- ppr sty (HsChar c) = text (show c)
- ppr sty (HsCharPrim c) = (<>) (text (show c)) (char '#')
- ppr sty (HsString s) = text (show s)
- ppr sty (HsStringPrim s) = (<>) (text (show s)) (char '#')
- ppr sty (HsInt i) = integer i
- ppr sty (HsFrac f) = rational f
- ppr sty (HsFloatPrim f) = (<>) (rational f) (char '#')
- ppr sty (HsDoublePrim d) = (<>) (rational d) (text "##")
- ppr sty (HsIntPrim i) = (<>) (integer i) (char '#')
- ppr sty (HsLitLit s) = hcat [text "``", ptext s, text "''"]
+ -- Use "show" because it puts in appropriate escapes
+ ppr (HsChar c) = text (show c)
+ ppr (HsCharPrim c) = text (show c) <> char '#'
+ ppr (HsStringPrim s) = pprFSAsString s <> char '#'
+ ppr (HsString s) = pprFSAsString s
+ 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 (HsLitLit s) = hcat [text "``", ptext s, text "''"]
\end{code}