diff options
Diffstat (limited to 'compiler/utils/Pretty.hs')
-rw-r--r-- | compiler/utils/Pretty.hs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index 98490322c5..5b025d5c05 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -1018,9 +1018,6 @@ hPutLitString handle a l = if l == 0 -- and async exception-safe. We only have a single thread and don't -- care about exceptions, so we add a layer of fast buffering -- over the Handle interface. --- --- (3) a few hacks in layLeft below to convince GHC to generate the right --- code. printLeftRender :: Handle -> Doc -> IO () printLeftRender hdl doc = do @@ -1031,14 +1028,11 @@ printLeftRender hdl doc = do 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. layLeft :: BufHandle -> Doc -> IO () layLeft b _ | b `seq` False = undefined -- make it strict in b layLeft _ NoDoc = error "layLeft: NoDoc" -layLeft b (Union p q) = return () >> layLeft b (first p q) -layLeft b (Nest _ p) = return () >> layLeft b p +layLeft b (Union p q) = layLeft b (first p q) +layLeft b (Nest _ p) = layLeft b p layLeft b Empty = bPutChar b '\n' layLeft b (NilAbove p) = bPutChar b '\n' >> layLeft b p layLeft b (TextBeside s _ p) = put b s >> layLeft b p |