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.
This commit is contained in:
Joseph C. Sible 2020-02-01 23:07:16 -05:00
parent 8a005526cc
commit 76b798394f
1 changed files with 3 additions and 4 deletions

View File

@ -329,12 +329,11 @@ getCurrentContexts = Ms.gets contextStack
popContext = do popContext = do
v <- getCurrentContexts v <- getCurrentContexts
if not $ null v case v of
then do (a:r) -> do
let (a:r) = v
setCurrentContexts r setCurrentContexts r
return $ Just a return $ Just a
else [] ->
return Nothing return Nothing
pushContext c = do pushContext c = do