src/lsp/transport/service.bend checks
raw source on the hub · import 0xde9bb08f7de298b03207fb5797ede9a5/src/lsp/transport/service.bend as Service
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.
1 import
import Base
Types
type Transport source · line 7 · raw
@-H:Type -> Type
effect service over a handle H: receive a body, send a body, each handing the handle back
Transport@-H:Type -> @recv:(@_:H -> IO(Pair(H, Maybe<&2, String>))) -> @send:(@_:H -> @_:String -> IO(H)) -> Transport<H>
Definitions
def recv source · line 11 · raw
@-H:Type -> @tt:Transport<H> -> @hh:H -> IO(Pair(H, Maybe<&2, String>))
the next message's body; None when the peer is gone
def send source · line 16 · raw
@-H:Type -> @tt:Transport<H> -> @hh:H -> @body:String -> IO(H)
a body, through a transport