Skip to content

Commit 601a573

Browse files
committed
Redesign concat
1 parent cdc80a8 commit 601a573

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Data/Text/Lazy.hs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -794,12 +794,10 @@ foldr1 f t = S.foldr1 f (stream t)
794794

795795
-- | /O(n)/ Concatenate a list of 'Text's.
796796
concat :: [Text] -> Text
797-
concat = to
798-
where
799-
go Empty css = to css
800-
go (Chunk c cs) css = Chunk c (go cs css)
801-
to [] = Empty
802-
to (cs:css) = go cs css
797+
concat [] = Empty
798+
concat (Empty : css) = concat css
799+
concat (Chunk c Empty : css) = Chunk c (concat css)
800+
concat (Chunk c cs : css) = Chunk c (concat (cs : css))
803801
{-# INLINE concat #-}
804802

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

0 commit comments

Comments
 (0)