def stem
import bolt@1.27.0.0/src/lsp/report.bend as Reportimport Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
119# the text before the first `~`: an instance of a template (`f~1`) is the
120# template's
121def stem(ss: String) -> String:
122 match ss:
123 case SNil{}:
124 SNil{}
125 case SCon{+hh, tt}:
126 Lazy.stop(String, Char.is_eq(hh, '~'), SNil{}, _u => SCon{hh, stem(tt)})