summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-09-16 12:05:14 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-18 12:02:56 -0400
commit78d27dd8fc376321097d242eee7f9c3346e52832 (patch)
treea11825a39f005b37fb58c43238deabd99452f008
parente17a37df945473ff3422abee5cb055c094ed4339 (diff)
downloadhaskell-78d27dd8fc376321097d242eee7f9c3346e52832.tar.gz
docs: Fix examples for (un)escapeArgs
The examples were just missing the surrounding brackets. ghci> escapeArgs ["hello \"world\""] "hello\\ \\\"world\\\"\n" Fixes #20340
-rw-r--r--libraries/base/GHC/ResponseFile.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/GHC/ResponseFile.hs b/libraries/base/GHC/ResponseFile.hs
index 1b6c2b8647..6d3df4454b 100644
--- a/libraries/base/GHC/ResponseFile.hs
+++ b/libraries/base/GHC/ResponseFile.hs
@@ -77,7 +77,7 @@ getArgsWithResponseFiles = getArgs >>= expandResponse
-- are between the original, un-concatenated list of strings. These
-- added whitespace characters are removed from the output.
--
--- > unescapeArgs "hello\\ \\\"world\\\"\n" == escapeArgs "hello \"world\""
+-- > unescapeArgs "hello\\ \\\"world\\\"\n" == ["hello \"world\""]
unescapeArgs :: String -> [String]
unescapeArgs = filter (not . null) . unescape
@@ -96,7 +96,7 @@ unescapeArgs = filter (not . null) . unescape
-- and thus will always escape any whitespace, quotes, and
-- backslashes.
--
--- > unescapeArgs "hello\\ \\\"world\\\"\\n" == escapeArgs "hello \"world\""
+-- > escapeArgs ["hello \"world\""] == "hello\\ \\\"world\\\"\n"
escapeArgs :: [String] -> String
escapeArgs = unlines . map escapeArg