From d3001f337aa3f7653a621b302261f4eac01890d0 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Fri, 13 Dec 2024 23:57:50 -0500 Subject: [PATCH] Simplify getParseOutput --- src/ShellCheck/Parser.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 66d62ffc9..9628b2ea5 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -3451,12 +3451,12 @@ isNotOk p s = parsesCleanly p s == Nothing -- The string does not parse -- If the parser matches the string, return Right [ParseNotes+ParseProblems] -- If it does not match the string, return Left [ParseProblems] getParseOutput parser string = runIdentity $ do - (res, sys) <- runParser testEnvironment - (parser >> eof >> getState) "-" string - case (res, sys) of - (Right userState, systemState) -> - return $ Right $ parseNotes userState ++ parseProblems systemState - (Left _, systemState) -> return $ Left $ parseProblems systemState + (res, systemState) <- runParser testEnvironment + (parser >> eof >> getState) "-" string + return $ case res of + Right userState -> + Right $ parseNotes userState ++ parseProblems systemState + Left _ -> Left $ parseProblems systemState -- If the parser matches the string, return Just whether it was clean (without emitting suggestions) -- Otherwise, Nothing