From 76b798394f18307677b44e231d6922db251955be Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sat, 1 Feb 2020 23:07:16 -0500 Subject: [PATCH] Use case matching instead of null Using null followed by a head, tail, or a partial pattern match is an anti-pattern. Use case matching instead. --- src/ShellCheck/Parser.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 727572d..025fa98 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -329,12 +329,11 @@ getCurrentContexts = Ms.gets contextStack popContext = do v <- getCurrentContexts - if not $ null v - then do - let (a:r) = v + case v of + (a:r) -> do setCurrentContexts r return $ Just a - else + [] -> return Nothing pushContext c = do