Forbid ... as ..variable.. patterns.
as can quickly lead to barely readable, long patterns:
Node _ (Expression.Lambda ({ argumentPatterns, resultExpression, arrowRange } as lambda)) ->
xcompared to
Node _ (Expression.Lambda lambda) ->
let
{ argumentPatterns, resultExpression, arrowRange } =
lambda
in
xless syntax to learn to use right and keep in your head
as in case of patterns can create variables with types that know less than you:
highestScoreUi ... =
case computeScores ... of
[] ->
textUi "no scores, yet"
(head :: _) as scores ->
case List.maximum scores of
-- This can never happen
Nothing ->
-- so we'll just use the head
scoreUi head
Just highestFound ->
scoreUi highestFoundcompared to
highestScoreUi ... =
case computeScores ... of
[] ->
textUi "no scores, yet"
scoresHead :: scoresTail ->
scoreUi (List.Nonempty.maximum ( scoresHead, scoresTail ))There are many more reasons for not introducing variables like that, see VariablesBetweenCaseOf.AccessInCases.forbid.
Forbid
... as ..variable..patterns.For example
will be fixed to
This fix doesn't try to merge this destructuring into existing lets. Add
jfmengels/elm-review-simplifywill do this for you.