From 67abfe159e41e33a7ad17d9b5e130756cc447510 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Mon, 1 Jan 2024 19:04:26 -0500 Subject: [PATCH] Remove most of the partial head and tail functions from src/ShellCheck/CFG.hs --- src/ShellCheck/CFG.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ShellCheck/CFG.hs b/src/ShellCheck/CFG.hs index 5d018c8..e1d3259 100644 --- a/src/ShellCheck/CFG.hs +++ b/src/ShellCheck/CFG.hs @@ -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