def stdio.cut
ezmcp@0.1.0.0 · src/io.bend:317
import ezmcp@0.1.0.0/src/io.bend as Io
import Base
import emerging-ezjson@1.2.0.0/src/value.bend as Value
import ezmcp@0.1.0.0/src/rpc.bend as Rpc
import ezmcp@0.1.0.0/src/server.bend as Server
import ezmcp@0.1.0.0/src/line.bend as Line
317
318def stdio.cut(
319 ~C: Data,
320 ~run: C -> String -> Value.Json -> IO(Rpc.Out),
321 ~srv: Server.Server,
322 +ctx: C,
323 rev: String,
324 again: List<&2, U32> -> String -> IO(Unit),
325 cut: Line.Cut
326) -> IO(Unit):
327 match cut:
328 case Line.Cut{lines, rest}:
329 IO.bind(String, Unit, stdio.lines(C, run, srv, ctx, lines, rev),
330 after => again(rest, after))