>>> words (unwords [" "]) [] >>> unwords (words "foo\nbar") "foo bar"
>>> unwords ["Lorem", "ipsum", "dolor"] "Lorem ipsum dolor"
>>> unwords ["foo", "bar", "", "baz"] "foo bar baz"
ghci> os <- Streams.unwords Streams.stdout ghci> forM_ [Just "Hello,", Nothing, Just "world!\n"] $ w -> Streams.write w os Hello, world!
unwords :: [Text] -> Textbut it was given a more complex type to provide friendlier compile time errors.
>>> unwords [] "" >>> unwords ["singleWord"] "singleWord" >>> unwords ["word", "another"] "word another" >>> unwords (["word", "another"] :: [String]) ... ... 'unwords' works with 'Text', not 'String'. Possible fixes: 1. Make sure OverloadedStrings extension is enabled. 2. Apply 'toText' to a single value. 3. Apply 'map toText' to the list value. ... >>> unwords [True, False] ... ... 'unwords' works with 'Text' But given: 'Bool' ...
> unwords ["abc","def","ghi"] "abc def ghi"
>>> Stream.fold Fold.toList $ Unicode.unwords $ Stream.fromList ["unwords", "this", "string"] "unwords this string"
unwords = S.unwords A.readNote that, in general
unwords . words /= id
>>> unwords = Stream.unfoldEachSepBy ' ' >>> unwords = Stream.unfoldEachSepBySeq " " Unfold.fromListPre-release
>>> fmt $ unwordsF ["hello", "world"] hello worldOf course, it works on anything Buildable:
>>> fmt $ unwordsF [1, 2] 1 2