on master help sign in
fix mapAccumL when `f` maps Chars that fit in a single Word16 to Chars that require two
commite05ab76707dbf65e48302c11cd19a87d986fe2ee authorEric Seidel <gridaphobe@gmail.com> dateMon 10 Jun 2013, 18:18 (13 years ago) parent0fc9b4d
1 file changed+3−3
Data/Text/Fusion.hs+3−3
Data/Text/Fusion.hs+3−3
@@ -223,9 +223,9 @@ mapAccumL f z0 (Stream next0 s0 len) = (nz,I.textP na 0 nl)
223223 arr' <- A.new top'
224224 A.copyM arr' 0 arr 0 top
225225 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
228227 loop z' s' (i+d)
229− where j | ord x < 0x10000 = i
228+ where (z',c) = f z x
229+ j | ord c < 0x10000 = i
230230 | otherwise = i + 1
231231{-# INLINE [0] mapAccumL #-}