def tail

bolt@1.27.0.0 · src/rules/correctness/twice.bend:31

import bolt@1.27.0.0/src/rules/correctness/twice.bend as Twice
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree

31# the rest of a list pattern after its first element
32def tail(pat: Tree.Node) -> Tree.Node:
33  match pat:
34    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TUpper{}, t, l, c}},
35        Tree.NCons{Tree.Group{open, Tree.NCons{x, Tree.NCons{comma, kids}}, close}, rest}}:
36      kids
37    case Tree.NCons{x, Tree.NCons{op, rest}}:
38      rest
39    case other:
40      Tree.NNil{}

Uses (3)

Used by (1)