[commit: ghc] master: base: Add bangs to GHC.IO.Handle.Text hGet* functions (88130db)

git at git.haskell.org git at git.haskell.org
Mon Sep 17 16:23:43 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/88130dbe948eaa7f76cf237d8aba17b41fac4904/ghc

>---------------------------------------------------------------

commit 88130dbe948eaa7f76cf237d8aba17b41fac4904
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Sep 17 16:46:26 2018 +0200

    base: Add bangs to GHC.IO.Handle.Text hGet* functions
    
    Summary:
    I believe that demand analysis doesn't notice that these are morally strict in
    the pointer argument due to the `count == 0` special case. Fixes #15638.
    
    Test Plan: Validate
    
    Reviewers: andrewthad, hvr
    
    Reviewed By: andrewthad
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15638
    
    Differential Revision: https://phabricator.haskell.org/D5149


>---------------------------------------------------------------

88130dbe948eaa7f76cf237d8aba17b41fac4904
 libraries/base/GHC/IO/Handle/Text.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs
index 943d769..dcf4b7c 100644
--- a/libraries/base/GHC/IO/Handle/Text.hs
+++ b/libraries/base/GHC/IO/Handle/Text.hs
@@ -808,7 +808,7 @@ writeChunkNonBlocking h_ at Handle__{..} ptr bytes
 -- on the 'Handle', and reads bytes directly.
 
 hGetBuf :: Handle -> Ptr a -> Int -> IO Int
-hGetBuf h ptr count
+hGetBuf h !ptr count
   | count == 0 = return 0
   | count <  0 = illegalBufferSize h "hGetBuf" count
   | otherwise =
@@ -890,7 +890,7 @@ bufReadEmpty h_ at Handle__{..}
 -- 'NewlineMode' on the 'Handle', and reads bytes directly.
 
 hGetBufSome :: Handle -> Ptr a -> Int -> IO Int
-hGetBufSome h ptr count
+hGetBufSome h !ptr count
   | count == 0 = return 0
   | count <  0 = illegalBufferSize h "hGetBufSome" count
   | otherwise =
@@ -935,7 +935,7 @@ haFD h_ at Handle__{..} = cast haDevice
 -- behaves identically to 'hGetBuf'.
 
 hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int
-hGetBufNonBlocking h ptr count
+hGetBufNonBlocking h !ptr count
   | count == 0 = return 0
   | count <  0 = illegalBufferSize h "hGetBufNonBlocking" count
   | otherwise =



More information about the ghc-commits mailing list