X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FPretty.lhs;h=3e08814ceb9f07b6d3972fe5554fbeaf7cb59aca;hb=8ffd91b6102f4ad3111cabdf6bdb1998f257887f;hp=7aec715d7a2ba3276d0d4263e5331492ee4d26e4;hpb=66b17554b1415df8e505793802ccd14dee66d6db;p=ghc-hetmet.git diff --git a/compiler/utils/Pretty.lhs b/compiler/utils/Pretty.lhs index 7aec715..3e08814 100644 --- a/compiler/utils/Pretty.lhs +++ b/compiler/utils/Pretty.lhs @@ -176,7 +176,8 @@ module Pretty ( hang, punctuate, -- renderStyle, -- Haskell 1.3 only - render, fullRender, printDoc, showDocWith + render, fullRender, printDoc, showDocWith, + bufLeftRender -- performance hack ) where import BufWrite @@ -1042,9 +1043,12 @@ hPutLitString handle a l = if l ==# _ILIT(0) printLeftRender :: Handle -> Doc -> IO () printLeftRender hdl doc = do b <- newBufHandle hdl - layLeft b (reduceDoc doc) + bufLeftRender b doc bFlush b +bufLeftRender :: BufHandle -> Doc -> IO () +bufLeftRender b doc = layLeft b (reduceDoc doc) + -- HACK ALERT! the "return () >>" below convinces GHC to eta-expand -- this function with the IO state lambda. Otherwise we end up with -- closures in all the case branches.