Commit b1e0c65a authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Make GHC.IO.Buffer.summaryBuffer strict

I came across this when debugging something else.  Making it strict
improves the code slightly without affecting behaviour.
parent a8fde183
{-# 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
......
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