From c1452e0d174fe6c4c0a3775d6ee430de1bd8ccda Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Tue, 19 Dec 2023 00:53:08 -0500 Subject: [PATCH] Remove unnecessary partiality from kludgeAwayQuotes --- src/ShellCheck/Parser.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 0e2fc6d34..115de6470 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -46,6 +46,7 @@ import Text.Parsec.Error import Text.Parsec.Pos import qualified Control.Monad.Reader as Mr import qualified Control.Monad.State as Ms +import qualified Data.List.NonEmpty as NE import qualified Data.Map.Strict as Map import Test.QuickCheck.All (quickCheckAll) @@ -2904,8 +2905,8 @@ readLetSuffix = many1 (readIoRedirect <|> try readLetExpression <|> readCmdWord) kludgeAwayQuotes :: String -> SourcePos -> (String, SourcePos) kludgeAwayQuotes s p = case s of - first:rest@(_:_) -> - let (last:backwards) = reverse rest + first:second:rest -> + let (last NE.:| backwards) = NE.reverse (second NE.:| rest) middle = reverse backwards in if first `elem` "'\"" && first == last