Io.stdio.act: def of ezmcp@0.1.0.0 Import: import ezmcp@0.1.0.0/src/io.bend as Io Lines 263-285 of ezmcp@0.1.0.0/src/io.bend: https://jend.leeeet.dev/read.txt?path=ezmcp@0.1.0.0/src/io.bend&start_line=263&end_line=285 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 # act on one line's act, read by revision `rev`: write a reply as one line, # or run the tool and write its reply, or run a batch's acts and write the # array of their replies, or write nothing def stdio.act( ~C: Data, ~run: C -> String -> Value.Json -> IO(Rpc.Out), +ctx: C, +rev: String, act: Server.Act ) -> IO(Unit): match act: case Server.Quiet{}: IO.pure(Unit, Unit{}) case Server.Send{reply}: IO.write(Line.frame(reply)) case Server.Fault{reply}: IO.write(Line.frame(reply)) case Server.Run{id, name, args}: IO.bind(Rpc.Out, Unit, run(ctx, name, args), out => IO.write(Line.frame(Server.ran(rev, id, out)))) case Server.Batch{acts}: IO.bind(List<&2, Maybe<&2, Value.Json>>, Unit, act.all(C, run, ctx, rev, acts), rs => stdio.batch(Server.batch.reply(rs))) Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.write https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=emerging-ezjson@1.3.0.0/src/value.bend&name=Json https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/io.bend&name=act.all https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/io.bend&name=stdio.batch https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/line.bend&name=frame https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/rpc.bend&name=Out https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/server.bend&name=Act https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/server.bend&name=batch.reply https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/server.bend&name=ran