From 84cde234811469611809745721ca67e9cee3fac0 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Thu, 26 Aug 2021 23:38:34 +0100 Subject: [PATCH] Redesign concat --- src/Data/Text/Lazy.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Data/Text/Lazy.hs b/src/Data/Text/Lazy.hs index 4e588691..9de3dada 100644 --- a/src/Data/Text/Lazy.hs +++ b/src/Data/Text/Lazy.hs @@ -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