def cut.go
import gralha-http-core@0.1.0.0/http.bend as Httpimport Base
17# The text before the first sep and the text after it, or None without sep.
18def cut.go(s: String, +sep: String, +acc: String) -> Maybe<&1, String & String>:
19 match s:
20 case SNil{}:
21 None{}
22 case SCon{+h, +t}:
23 when(Maybe<&1, String & String>, String.starts_with(SCon{h, t}, sep),
24 _ => Some{(String.reverse(acc), String.drop(SCon{h, t}, String.length(sep)))},
25 _ => cut.go(t, sep, SCon{h, acc}))