You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm thinking of expressing the steeloverseer "server" as a stream of typed "messages", where each one is responded to by the client (front-end: terminal, ncurses, etc).
Haven't though about it too hard but here's what I've come up with:
Use a typed GADT for the message type, produced by the server process and tagged with the expected type of the client response.
dataMessageFawhere-- "I just started a job"JobStarted::JobDescription->MessageF()-- client responds with (), aka "ok"-- "The current job produced a line of output"Stdout::Text->MessageF()-- "A job exited unsuccessfully, continue?"JobDied::JobDescription->MessageFBool
The exact messages obviously need to be fleshed out a bit. Anyways, with this GADT, I think we can reuse the streaming machinery with a clever functor:
dataMessagea=forallx.Message (MessageFx) (x->a)
Thus, the overall type of the server is something like
Cool, I'm gonna poke at this tonight. One potential wart is that it strictly encodes a 1:1 request-response style protocol, so any fancy ncurses frontend that wants to have a fully duplex communication channel would be much better off with a socket pair, or just a pair of Chan, or whatever.
Still, playing around in the type system is too much fun :D
I'm thinking of expressing the steeloverseer "server" as a stream of typed "messages", where each one is responded to by the client (front-end: terminal, ncurses, etc).
Haven't though about it too hard but here's what I've come up with:
Use a typed GADT for the message type, produced by the server process and tagged with the expected type of the client response.
The exact messages obviously need to be fleshed out a bit. Anyways, with this GADT, I think we can reuse the
streaming
machinery with a clever functor:Thus, the overall type of the server is something like
which expands to (basically)
The text was updated successfully, but these errors were encountered: