Skip to content

Commit

Permalink
Fix a duplicated splitWith bug.
Browse files Browse the repository at this point in the history
--HG--
extra : convert_revision : a136358e3a0c307689b2851ec2e0824cb23abf1b
  • Loading branch information
bos committed Aug 14, 2009
1 parent 1e385a4 commit 4b9cec0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Data/Text/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,9 @@ split c = splitWith (==c)
-- separators result in an empty component in the output. eg.
--
-- > splitWith (=='a') "aabbaca" == ["","","bb","c",""]
-- > splitWith (=='a') [] == []
-- > splitWith (=='a') [] == [""]
splitWith :: (Char -> Bool) -> Text -> [Text]
splitWith _ Empty = []
splitWith _ Empty = [Empty]
splitWith p (Chunk t0 ts0) = comb [] (T.splitWith p t0) ts0
where comb acc (s:[]) Empty = revChunks (s:acc) : []
comb acc (s:[]) (Chunk t ts) = comb (s:acc) (T.splitWith p t) ts
Expand Down

0 comments on commit 4b9cec0

Please sign in to comment.