bolt/lsp/transport/service.bend source
bolt/lsp/transport/service.bend on the hub · documented module
# transport: an effect service: one message body in, one out. H is the# implementation's handle state; it is affine, so every call hands it back.import Base# effect service over a handle H: receive a body, send a body, each handing the# handle backtype Transport<-H: Type> is Type: Transport{recv: H -> IO(H & Maybe<&2, String>), send: H -> String -> IO(H)}# the next message's body; None when the peer is gonedef recv(-H: Type, t: Transport<H>, h: H) -> IO(H & Maybe<&2, String>): Transport{r, s} = t r(h)# a body, through a transportdef send(-H: Type, t: Transport<H>, h: H, body: String) -> IO(H): Transport{r, s} = t s(h, body)