[commit: ghc] wip/nfs-locking: Fix infinite loop bug in chunksOfSize. (1d27a44)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:36:18 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/1d27a444cc91ce912bbff440507170cc14729961/ghc

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

commit 1d27a444cc91ce912bbff440507170cc14729961
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Aug 21 23:39:06 2015 +0100

    Fix infinite loop bug in chunksOfSize.


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

1d27a444cc91ce912bbff440507170cc14729961
 src/Util.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Util.hs b/src/Util.hs
index b39fc6c..51b5ccb 100644
--- a/src/Util.hs
+++ b/src/Util.hs
@@ -49,7 +49,7 @@ chunksOfSize size strings = reverse chunk : chunksOfSize size rest
     (chunk, rest) = go [] 0 strings
     go res _         []     = (res, [])
     go res chunkSize (s:ss) =
-        if newSize > size then (chunk, s:ss) else go (s:res) newSize ss
+        if newSize > size then (res, s:ss) else go (s:res) newSize ss
       where
         newSize = chunkSize + length s
 



More information about the ghc-commits mailing list