on master help sign in
fix mapAccumL when `f` maps Chars that fit in a single Word16 to Chars that require two
e05ab76Eric Seidel
Data/Text/Fusion.hs+3−3
@@ -223,9 +223,9 @@ mapAccumL f z0 (Stream next0 s0 len) = (nz,I.textP na 0 nl)
223 arr' <- A.new 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
227− d <- unsafeWrite arr i c
226+ | otherwise -> do d <- unsafeWrite arr i c
228 loop z' s' (i+d)
227 loop z' s' (i+d)
228+ where (z',c) = f z x
229− where j | ord x < 0x10000 = i
229+ j | ord c < 0x10000 = i
230 | otherwise = i + 1
230 | otherwise = i + 1
231{-# INLINE [0] mapAccumL #-}
231{-# INLINE [0] mapAccumL #-}