X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Futils%2FPretty.lhs;h=317022d66927e819f57e1fb4df9f514f06d542c5;hp=47d4b1e19e582225cae5e7da5d80aa0966706c52;hb=5289f5d85610f71625a439747a09384876655eb5;hpb=831a35dd00faff195cf938659c2dd736192b865f diff --git a/compiler/utils/Pretty.lhs b/compiler/utils/Pretty.lhs index 47d4b1e..317022d 100644 --- a/compiler/utils/Pretty.lhs +++ b/compiler/utils/Pretty.lhs @@ -152,6 +152,7 @@ Relative to John's original paper, there are the following new features: \begin{code} +{-# LANGUAGE BangPatterns #-} {-# OPTIONS -fno-warn-unused-imports #-} -- XXX GHC 6.9 seems to be confused by unpackCString# being used only in -- a RULE @@ -1000,10 +1001,6 @@ spaces n | n <=# _ILIT(0) = "" pprCols :: Int pprCols = 100 -- could make configurable --- NB. printDoc prints FastStrings in UTF-8: hPutFS below does no decoding. --- This is what we usually want, because the IO library has no encoding --- functionality, and we're assuming UTF-8 source code so we might as well --- assume UTF-8 output too. printDoc :: Mode -> Handle -> Doc -> IO () printDoc LeftMode hdl doc = do { printLeftRender hdl doc; hFlush hdl } @@ -1013,7 +1010,9 @@ printDoc mode hdl doc where put (Chr c) next = hPutChar hdl c >> next put (Str s) next = hPutStr hdl s >> next - put (PStr s) next = hPutFS hdl s >> next + put (PStr s) next = hPutStr hdl (unpackFS s) >> next + -- NB. not hPutFS, we want this to go through + -- the I/O library's encoding layer. (#3398) put (LStr s l) next = hPutLitString hdl s l >> next done = hPutChar hdl '\n'