@@ -1880,20 +1880,18 @@ writeWith elemCount =
1883− insertElem (MutArray contents start end bound) x = do
1884− liftIO $ pokeWith contents end x
1885− return $ MutArray contents start (INDEX_NEXT(end,a)) bound
1887 initial = do
1883 initial = do
1888 when (elemCount < 0) $ error "writeWith: elemCount is negative"
1884 when (elemCount < 0) $ error "writeWith: elemCount is negative"
1889 liftIO $ newPinned elemCount
1885 liftIO $ newPinned elemCount
1890 step arr@(MutArray _ start end bound) x
1887 step arr@(MutArray _ start end bound) x
1891 | INDEX_NEXT(end,a) > bound = do
1888 | INDEX_NEXT(end,a) > bound = do
1892 let oldSize = end - start
1889 let oldSize = end - start
1893 newSize = max (oldSize * 2) 1
1890 newSize = max (oldSize * 2) 1
1894 arr1 <- liftIO $ reallocExplicit (SIZE_OF(a)) newSize arr
1891 arr1 <- liftIO $ reallocExplicit (SIZE_OF(a)) newSize arr
1895− insertElem arr1 x
1892+ snocUnsafe arr1 x
1896− step arr x = insertElem arr x
1893+ step arr x = snocUnsafe arr x
1897 extract = liftIO . rightSize
1895 extract = liftIO . rightSize
1899-- | Fold the whole input to a single array.
1897-- | Fold the whole input to a single array.