Skip to content

Commit

Permalink
Redesign concat
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodigrim committed Aug 30, 2021
1 parent e8f48b9 commit 84cde23
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Data/Text/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,10 @@ foldr1 f t = S.foldr1 f (stream t)

-- | /O(n)/ Concatenate a list of 'Text's.
concat :: [Text] -> Text
concat = to
where
go Empty css = to css
go (Chunk c cs) css = Chunk c (go cs css)
to [] = Empty
to (cs:css) = go cs css
concat [] = Empty
concat (Empty : css) = concat css
concat (Chunk c Empty : css) = Chunk c (concat css)
concat (Chunk c cs : css) = Chunk c (concat (cs : css))
{-# INLINE concat #-}

-- | /O(n)/ Map a function over a 'Text' that results in a 'Text', and
Expand Down

0 comments on commit 84cde23

Please sign in to comment.