:: [String] -> String -package:rio

Appends a \n character to each input string, then concatenates the results. Equivalent to foldMap (s -> s ++ "\n").

Examples

>>> unlines ["Hello", "World", "!"]
"Hello\nWorld\n!\n"
Note that unlines . lines /= id when the input is not \n-terminated:
>>> unlines . lines $ "foo\nbar"
"foo\nbar\n"
unwords joins words with separating spaces (U+0020 SPACE). unwords is neither left nor right inverse of words:
>>> words (unwords [" "])
[]

>>> unwords (words "foo\nbar")
"foo bar"

Examples

>>> unwords ["Lorem", "ipsum", "dolor"]
"Lorem ipsum dolor"
>>> unwords ["foo", "bar", "", "baz"]
"foo bar  baz"
Given a list of strings, concatenate them into a single string with escaping of certain characters, and the addition of a newline between each string. The escaping is done by adding a single backslash character before any whitespace, single quote, double quote, or backslash character, so this escaping character must be removed. Unescaped whitespace (in this case, newline) is part of this "transport" format to indicate the end of the previous string and the start of a new string. While unescapeArgs allows using quoting (i.e., convenient escaping of many characters) by having matching sets of single- or double-quotes,escapeArgs does not use the quoting mechanism, and thus will always escape any whitespace, quotes, and backslashes.
escapeArgs ["hello \"world\""] == "hello\\ \\\"world\\\"\n"
Like unlines, but does not append a trailing newline if there is at least one line. For example:
unlinesConcise ["A", "B"] == "A\nB"
unlinesConcise [] == ""
Whereas:
unlines ["A", "B"] == "A\nB\n"
unlines [] == ""
This is closer to the behaviour of unwords, which does not append a trailing space.
Appends a \n character to each input string, then concatenates the results. Equivalent to foldMap (s -> s ++ "\n").
>>> unlines ["Hello", "World", "!"]
"Hello\nWorld\n!\n"
Note that unlines . lines /= id when the input is not \n-terminated:
>>> unlines . lines $ "foo\nbar"
"foo\nbar\n"
unwords joins words with separating spaces (U+0020 SPACE).
>>> unwords ["Lorem", "ipsum", "dolor"]
"Lorem ipsum dolor"
unwords is neither left nor right inverse of words:
>>> words (unwords [" "])
[]

>>> unwords (words "foo\nbar")
"foo bar"
Given a sequence of arguments, join them together in a manner that could be used on the command line, giving preference to the Windows cmd shell quoting conventions. For an alternative version, intended for actual running the result in a shell, see "System.Process.showCommandForUser"
Form a path from path components. This isn't the inverse of slice_path, since unslice_path . slice_path normalises the path. See slice_path.
Form file name from file name components, interspersing dots. This is the inverse of slice_filename, except for normalisation of any path.
unslice_filename = concat . intersperse "."
See slice_filename.
unwords is an inverse operation to words. It joins words with separating spaces.
>>> unwords ["Lorem", "ipsum", "dolor"]
"Lorem ipsum dolor"
unlines is an inverse operation to lines. It joins lines, after appending a terminating newline to each.
>>> unlines ["Hello", "World", "!"]
"Hello\nWorld\n!\n"
Mostly meant for internal usage
Render a path as a /-delimited string
Quote-aware version of unwords - single-quote strings which contain whitespace
unwords, but remove empty words first.
Wrap the given commands in a progn. The given commands need not be wrapped in parentheses (but can); this will be done by the function. For example:
>>> progn [require "this-lib", "function-from-this-lib arg", "(other-function arg2)"]
"(progn (require (quote this-lib)) (function-from-this-lib arg) (other-function arg2))"
Make a list of the given inputs.
>>> list ["foo", "bar", "baz", "qux"]
"(list foo bar baz qux)"
Like progn, but with save-excursion.
>>> saveExcursion [require "this-lib", "function-from-this-lib arg", "(other-function arg2)"]
"(save-excursion (require (quote this-lib)) (function-from-this-lib arg) (other-function arg2))"