def is_step

bend-lint-rules@0.2.0.0 · performance/unused_result.bend:41

import bend-lint-rules@0.2.0.0/performance/unused_result.bend as UnusedResult
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

41# Whether a lambda below `path` is the rest of a step of a `do` block (`x : T <- m`, the last argument of a call of a
42# bind): its value comes from the monad, which makes it whether it is used or not.
43def is_step(path: List<&2, Lint.Above>) -> Bool:
44  match path:
45    case Con{
46      Lint.Above{
47        Lint.Node{
48          Lint.Application{},
49          n,
50          s,
51          Con{Lint.Node{Lint.Reference{t}, rn, rs, rk, rf}, args},
52          f
53        },
54        at
55      },
56      rest
57    }:
58      String.ends_with(t, ".bind")
59    case _:
60      False{}

Uses (6)

Used by (1)