src/lsp/transport/service.bend source
src/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: # noqa: L001 effect record 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, tt: Transport<H>, hh: H) -> IO(H & Maybe<&2, String>): # noqa: L001 effect accessor Transport{r, s} = tt r(hh)# a body, through a transportdef send(-H: Type, tt: Transport<H>, hh: H, body: String) -> IO(H): # noqa: L001 effect accessor Transport{r, s} = tt s(hh, body)