Skip to content

Commit

Permalink
⚡️ Use lazy default to avoid unnecessary recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
SiriusStarr committed Oct 19, 2023
1 parent 8dba59b commit 72018af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ReviewPipelineStyles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 ->
Expand Down

0 comments on commit 72018af

Please sign in to comment.