@@ -109,8 +109,10 @@ module Data.Text
109 -- , breakSubstring
109 -- , breakSubstring
111 -- ** Breaking into lines and words
111 -- ** Breaking into lines and words
115 -- * Predicates
117 -- * Predicates
116 -- , isPrefixOf
118 -- , isPrefixOf
@@ -655,5 +657,16 @@ lines ps
655 where search = elemIndex '\n'
657 where search = elemIndex '\n'
656{-# INLINE lines #-}
658{-# INLINE lines #-}
660+-- | /O(n)/ Joins lines, after appending a terminating newline to
662+unlines :: [Text] -> Text
663+unlines = concat . L.map (`snoc` '\n')
664+{-# INLINE unlines #-}
666+-- | /O(n)/ Joins words using single space characters.
667+unwords :: [Text] -> Text
668+unwords = intercalate (singleton ' ')
669+{-# INLINE unwords #-}
658errorEmptyList :: String -> a
671errorEmptyList :: String -> a
659errorEmptyList fun = error ("Data.Text." ++ fun ++ ": empty list")
672errorEmptyList fun = error ("Data.Text." ++ fun ++ ": empty list")