@@ -50,6 +50,7 @@ module Data.Text
51 -- * Transformations
51 -- * Transformations
53 , intersperse
54 , intersperse
54 , transpose
55 , transpose
@@ -306,6 +307,13 @@ map :: (Char -> Char) -> Text -> Text
306map f t = unstream (S.map f (stream t))
307map f t = unstream (S.map f (stream t))
307{-# INLINE [1] map #-}
308{-# INLINE [1] map #-}
310+-- | /O(n)/ The 'intercalate' function takes a 'Text' and a list of
311+-- 'Text's and concatenates the list after interspersing the first
312+-- argument between each element of the list.
313+intercalate :: Text -> [Text] -> Text
314+intercalate t ts = unstream (S.intercalate (stream t) (L.map stream ts))
315+{-# INLINE intercalate #-}
309-- | /O(n)/ The 'intersperse' function takes a character and places it
317-- | /O(n)/ The 'intersperse' function takes a character and places it
310-- between the characters of a 'Text'. Subject to array fusion.
318-- between the characters of a 'Text'. Subject to array fusion.
311intersperse :: Char -> Text -> Text
319intersperse :: Char -> Text -> Text