summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/IO
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-10-02 15:28:35 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-10-03 09:52:39 +0100
commitb1e0c65a1302f998917e6d33d6e1ebb84cd09fa8 (patch)
tree361d256434e8a711bbfd7bcfe11f6fe9ba2ca762 /libraries/base/GHC/IO
parenta8fde1831f4b99885b8ed444f9cd7dffd9252150 (diff)
downloadhaskell-b1e0c65a1302f998917e6d33d6e1ebb84cd09fa8.tar.gz
Make GHC.IO.Buffer.summaryBuffer strict
I came across this when debugging something else. Making it strict improves the code slightly without affecting behaviour.
Diffstat (limited to 'libraries/base/GHC/IO')
-rw-r--r--libraries/base/GHC/IO/Buffer.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/libraries/base/GHC/IO/Buffer.hs b/libraries/base/GHC/IO/Buffer.hs
index 33eee6363d..f3cabb25c1 100644
--- a/libraries/base/GHC/IO/Buffer.hs
+++ b/libraries/base/GHC/IO/Buffer.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE Trustworthy, BangPatterns #-}
{-# LANGUAGE CPP, NoImplicitPrelude #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
@@ -264,7 +264,8 @@ foreign import ccall unsafe "memmove"
memmove :: Ptr a -> Ptr a -> CSize -> IO (Ptr a)
summaryBuffer :: Buffer a -> String
-summaryBuffer buf = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"
+summaryBuffer !buf -- Strict => slightly better code
+ = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"
-- INVARIANTS on Buffers:
-- * r <= w