From 72018af692fb949249c50abba98dcd3132ec6bbe Mon Sep 17 00:00:00 2001 From: SiriusStarr <2049163+SiriusStarr@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:37:05 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Use=20lazy=20default=20to?= =?UTF-8?q?=20avoid=20unnecessary=20recursion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ReviewPipelineStyles.elm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ReviewPipelineStyles.elm b/src/ReviewPipelineStyles.elm index 93e7ed7..3e43133 100644 --- a/src/ReviewPipelineStyles.elm +++ b/src/ReviewPipelineStyles.elm @@ -442,7 +442,7 @@ ruleToFilter ({ lookupTable } as context) (PipelineRule { forbidden, except, ope && MaybeX.unwrap True matchesPredicate forbidden && not (MaybeX.unwrap False matchesPredicate except) then - Maybe.withDefault (Fail { message = "Invalid ReviewPipelineStyles config!", details = [ "This should be impossible; please open a Github issue with your elm-review config!" ] }) error + MaybeX.withDefaultLazy (\() -> Fail { message = "Invalid ReviewPipelineStyles config!", details = [ "This should be impossible; please open a Github issue with your elm-review config!" ] }) error |> makeError context pipeline fix |> Just @@ -516,12 +516,12 @@ descendToPipelines context parents node = case Node.value node of OperatorApplication op dir left right -> getPipeline context parents node op dir left right - |> Maybe.withDefault (go left ++ go right) + |> MaybeX.withDefaultLazy (\() -> go left ++ go right) Application es -> -- Application might be the start of a parenthetical application pipeline getParentheticalPipeline context parents node - |> Maybe.withDefault (List.concatMap go es) + |> MaybeX.withDefaultLazy (\() -> List.concatMap go es) -- Descend into subexpression until we encounter a pipeline ParenthesizedExpression e ->