@@ -96,7 +96,7 @@ reverseStream (Text arr off len) = Stream next (off+len-1) (maxSize len)
96unstream :: Stream Char -> Text
96unstream :: Stream Char -> Text
97unstream (Stream next0 s0 len) = I.textP (P.fst a) 0 (P.snd a)
97unstream (Stream next0 s0 len) = I.textP (P.fst a) 0 (P.snd a)
99− a = A.run2 (A.unsafeNew mlen >>= \arr -> outer arr mlen s0 0)
99+ a = A.run2 (A.new mlen >>= \arr -> outer arr mlen s0 0)
100 where mlen = upperBound 4 len
100 where mlen = upperBound 4 len
101 outer arr top = loop
101 outer arr top = loop
@@ -107,7 +107,7 @@ unstream (Stream next0 s0 len) = I.textP (P.fst a) 0 (P.snd a)
107 Yield x s'
107 Yield x s'
108 | j >= top -> {-# SCC "unstream/resize" #-} do
108 | j >= top -> {-# SCC "unstream/resize" #-} do
109 let top' = (top + 1) `shiftL` 1
109 let top' = (top + 1) `shiftL` 1
110− arr' <- A.unsafeNew top'
110+ arr' <- A.new top'
111 A.copyM arr' 0 arr 0 top
111 A.copyM arr' 0 arr 0 top
112 outer arr' top' s i
112 outer arr' top' s i
113 | otherwise -> do d <- unsafeWrite arr i x
113 | otherwise -> do d <- unsafeWrite arr i x
@@ -132,7 +132,7 @@ reverse (Stream next s len0)
132 | otherwise = I.textP arr off' len'
132 | otherwise = I.textP arr off' len'
134 len0' = upperBound 4 (larger len0 4)
134 len0' = upperBound 4 (larger len0 4)
135− (arr, (off', len')) = A.run2 (A.unsafeNew len0' >>= loop s (len0'-1) len0')
135+ (arr, (off', len')) = A.run2 (A.new len0' >>= loop s (len0'-1) len0')
136 loop !s0 !i !len marr =
136 loop !s0 !i !len marr =
137 case next s0 of
137 case next s0 of
138 Done -> return (marr, (j, len-j))
138 Done -> return (marr, (j, len-j))
@@ -140,7 +140,7 @@ reverse (Stream next s len0)
140 Skip s1 -> loop s1 i len marr
140 Skip s1 -> loop s1 i len marr
141 Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
141 Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
142 let newLen = len `shiftL` 1
142 let newLen = len `shiftL` 1
143− marr' <- A.unsafeNew newLen
143+ marr' <- A.new newLen
144 A.copyM marr' (newLen-len) marr 0 len
144 A.copyM marr' (newLen-len) marr 0 len
145 write s1 (len+i) newLen marr'
145 write s1 (len+i) newLen marr'
146 | otherwise -> write s1 i len marr
146 | otherwise -> write s1 i len marr
@@ -209,7 +209,7 @@ countChar = S.countCharI
209mapAccumL :: (a -> Char -> (a,Char)) -> a -> Stream Char -> (a, Text)
209mapAccumL :: (a -> Char -> (a,Char)) -> a -> Stream Char -> (a, Text)
210mapAccumL f z0 (Stream next0 s0 len) = (nz,I.textP na 0 nl)
210mapAccumL f z0 (Stream next0 s0 len) = (nz,I.textP na 0 nl)
212− (na,(nz,nl)) = A.run2 (A.unsafeNew mlen >>= \arr -> outer arr mlen z0 s0 0)
212+ (na,(nz,nl)) = A.run2 (A.new mlen >>= \arr -> outer arr mlen z0 s0 0)
213 where mlen = upperBound 4 len
213 where mlen = upperBound 4 len
214 outer arr top = loop
214 outer arr top = loop
@@ -220,7 +220,7 @@ mapAccumL f z0 (Stream next0 s0 len) = (nz,I.textP na 0 nl)
220 Yield x s'
220 Yield x s'
221 | j >= top -> {-# SCC "mapAccumL/resize" #-} do
221 | j >= top -> {-# SCC "mapAccumL/resize" #-} do
222 let top' = (top + 1) `shiftL` 1
222 let top' = (top + 1) `shiftL` 1
223− arr' <- A.unsafeNew top'
223+ arr' <- A.new top'
224 A.copyM arr' 0 arr 0 top
224 A.copyM arr' 0 arr 0 top
225 outer arr' top' z s i
225 outer arr' top' z s i
226 | otherwise -> do let (z',c) = f z x
226 | otherwise -> do let (z',c) = f z x