Patch was taken from binary fork of ghc-7 branch Fri Jul 30 15:29:36 EEST 2010 simonpj@microsoft.com * Add type signature on local binding diff -rN -u old-binary/src/Data/Binary/Get.hs new-binary/src/Data/Binary/Get.hs --- old-binary/src/Data/Binary/Get.hs 2010-10-31 18:08:10.633817506 +0200 +++ new-binary/src/Data/Binary/Get.hs 2010-10-31 18:08:10.641817506 +0200 @@ -370,16 +370,17 @@ return (xs, ys)) where - first r 0 xs@(L.Chunk _ _) = writeSTRef r xs >> return L.Empty - first r _ L.Empty = writeSTRef r L.Empty >> return L.Empty - - first r n (L.Chunk x xs) - | n < l = do writeSTRef r (L.Chunk (B.drop (fromIntegral n) x) xs) - return $ L.Chunk (B.take (fromIntegral n) x) L.Empty - | otherwise = do writeSTRef r (L.drop (n - l) xs) - liftM (L.Chunk x) $ unsafeInterleaveST (first r (n - l) xs) - - where l = fromIntegral (B.length x) + first :: STRef s L.ByteString -> Int64 -> L.ByteString -> ST s L.ByteString + first r 0 xs@(L.Chunk _ _) = writeSTRef r xs >> return L.Empty + first r _ L.Empty = writeSTRef r L.Empty >> return L.Empty + + first r n (L.Chunk x xs) + | n < l = do writeSTRef r (L.Chunk (B.drop (fromIntegral n) x) xs) + return $ L.Chunk (B.take (fromIntegral n) x) L.Empty + | otherwise = do writeSTRef r (L.drop (n - l) xs) + liftM (L.Chunk x) $ unsafeInterleaveST (first r (n - l) xs) + where + l = fromIntegral (B.length x) #else splitAtST i (B.LPS ps) = runST ( do r <- newSTRef undefined