Skip to content

Commit

Permalink
mapAccumL and mapAccumR are non-decreasing
Browse files Browse the repository at this point in the history
  • Loading branch information
TeofilC committed Feb 10, 2023
1 parent f51caa3 commit 4187a35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Data/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ mapAccumL f z0 = go
| srcOff >= l + o = do
A.shrinkM dst dstOff
arr <- A.unsafeFreeze dst
return (z, text arr 0 dstOff)
return (z, Text arr 0 dstOff)
| dstOff + 4 > dstLen = do
let !dstLen' = dstLen + (l + o) - srcOff + 4
dst' <- A.resizeM dst dstLen'
Expand Down Expand Up @@ -1209,7 +1209,7 @@ mapAccumR f z0 = go
| srcOff < o = do
dstLen <- A.getSizeofMArray dst
arr <- A.unsafeFreeze dst
return (z, text arr (dstOff + 1) (dstLen - dstOff - 1))
return (z, Text arr (dstOff + 1) (dstLen - dstOff - 1))
| dstOff < 3 = do
dstLen <- A.getSizeofMArray dst
let !dstLen' = dstLen + (srcOff - o) + 4
Expand Down

0 comments on commit 4187a35

Please sign in to comment.