Remove most of the partial head and tail functions from src/ShellCheck/CFG.hs

This commit is contained in:
Joseph C. Sible 2024-01-01 19:04:26 -05:00
parent 025cc5266e
commit 67abfe159e
1 changed files with 5 additions and 5 deletions

View File

@ -615,15 +615,15 @@ build t = do
T_CaseExpression id t [] -> build t
T_CaseExpression id t list -> do
T_CaseExpression id t list@(hd:tl) -> do
start <- newStructuralNode
token <- build t
branches <- mapM buildBranch list
branches <- mapM buildBranch (hd NE.:| tl)
end <- newStructuralNode
let neighbors = zip branches $ tail branches
let (_, firstCond, _) = head branches
let (_, lastCond, lastBody) = last branches
let neighbors = zip (NE.toList branches) $ NE.tail branches
let (_, firstCond, _) = NE.head branches
let (_, lastCond, lastBody) = NE.last branches
linkRange start token
linkRange token firstCond