Replies: 1 comment 1 reply
-
For typed processes we could consider leveraging the existing literature on session types, whose scope is exactly typed concurrent processes (even more so since Linear Haskell, which makes the encoding of session types more convenient: https://arxiv.org/pdf/2103.14481.pdf) (I'm not an expert on session types!) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, a
Process
is not typed, as in, any (Typeable
) message can be sent to it, and it can check for any type of messages inreceive
.It may make sense (not sure, though!) to have a concept of "typed" processes as well. Basically, there'd be a
TypedProcess r msg
wrappingProcess r
, and with it aTypedProcessId msg
, and all utility functions lifted toTypedProcess r msg
. Then,receive
would be something like[TypedMatch msg a]
with, e.g.,MatchMessage (Message msg -> TypedProcess r msg a
(or something along those lines), andsend :: TypedProcessId msg -> msg -> m ()
.Of course, we should be able to deliver
Down
,Exit
and other "system" messages, hence theMessage
wrapper inreceive
. ATypedProcess r msg
doesn't actually receivemsg
messages, butMessage msg
wheredata Message = Exit | Down | UserMessage msg
(withExit
andDown
and others more elaborate of course). Alternatively,Message
could beSystemMessage _ | UserMessage msg
or similar, of course.Then,
receive
will use the untyped API and select on system messages or the user message type, wrapping things up accordingly.A wide design space, and as said, not sure this is a good idea. Thoughts welcome.
Beta Was this translation helpful? Give feedback.
All reactions