def stdio.turn

ezmcp@0.1.0.0 · src/io.bend:287

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

287# act on a turn read by revision `rev`, then go on with the revision after it
288def stdio.turn(
289  ~C: Data,
290  ~run: C -> String -> Value.Json -> IO(Rpc.Out),
291  +ctx: C,
292  +rev: String,
293  turn: Server.Turn,
294  next: String -> IO(String)
295) -> IO(String):
296  match turn:
297    case Server.Turn{act, after}:
298      IO.bind(Unit, String, stdio.act(C, run, ctx, rev, act), _u => next(after))

Uses (8)

Used by (1)