Commit cdbb9da7 authored by Sergei Trofimovich's avatar Sergei Trofimovich
Browse files

cleanup: drop 11 years old performance hack

The 'return () >>' hack was added in commit
    commit ac88f113


    Date:   Tue Jul 26 12:14:03 2005 +0000

Nowadays it has no effect on generated Core on -O1/-O2
and slightly bloats Core on -O0.
Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
parent 18057549
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment