def act.all
ezmcp@0.1.0.0 · src/io.bend:42
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
42
43def act.all(
44 ~C: Data,
45 ~run: C -> String -> Value.Json -> IO(Rpc.Out),
46 +ctx: C,
47 +rev: String,
48 acts: List<&2, Server.Act>
49) -> IO(List<&2, Maybe<&2, Value.Json>>):
50 match acts:
51 case []:
52 IO.pure(List<&2, Maybe<&2, Value.Json>>, [])
53 case a <> rest:
54 IO.bind(Maybe<&2, Value.Json>, List<&2, Maybe<&2, Value.Json>>,
55 act.reply(C, run, ctx, rev, a),
56 r => IO.bind(List<&2, Maybe<&2, Value.Json>>,
57 List<&2, Maybe<&2, Value.Json>>, act.all(C, run, ctx, rev, rest),
58 rs => IO.pure(List<&2, Maybe<&2, Value.Json>>, r <> rs)))