From ca41440a678879d586320250a4b91913d1256a6e Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sun, 5 Apr 2020 16:21:07 -0400 Subject: [PATCH] Simplify getSpecial --- src/ShellCheck/AnalyzerLib.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ShellCheck/AnalyzerLib.hs b/src/ShellCheck/AnalyzerLib.hs index 26e65e6..95b236a 100644 --- a/src/ShellCheck/AnalyzerLib.hs +++ b/src/ShellCheck/AnalyzerLib.hs @@ -826,9 +826,8 @@ getBracedReference s = fromMaybe s $ let name = takeWhile isVariableChar s guard . not $ null name return name - getSpecial (c:_) = - if c `elem` "*@#?-$!" then return [c] else fail "not special" - getSpecial _ = fail "empty" + getSpecial (c:_) | c `elem` "*@#?-$!" = return [c] + getSpecial _ = fail "empty or not special" nameExpansion ('!':rest) = do -- e.g. ${!foo*bar*} let suffix = dropWhile isVariableChar rest