ShapeOfMatter / MultiChor

Type-safe and efficient choreographies for Haskell, with multiply-located values, multi-cast, and location-set polymorphism.
Other
8 stars 0 forks source link

Add utilities for examining views #21

Open ShapeOfMatter opened 4 months ago

ShapeOfMatter commented 4 months ago

In various contexts, including some of our (planned) examples, we care about the transcripts (views) of various parties. We should write handlers to gather them explicitly.

ShapeOfMatter commented 4 months ago

should contribute toward #20.

psilospore commented 3 months ago

Would whatever is in https://github.com/ShapeOfMatter/HasChorPlus/blob/main/src/Choreography/Network/Local.hs already store the messages sent by different parties?

-- | Each location is associated with a message buffer which stores messages sent
-- from other locations.
type MsgBuf = HashMap LocTm (Chan String)

newtype LocalConfig = LocalConfig
  { locToBuf :: HashMap LocTm MsgBuf
  }
ShapeOfMatter commented 3 months ago

No, I don't think so. It's using Chans, which "store" the messages only until the relevant process consumes them.

I'm sure we could shim this to do what we want, and I'm not opposed to that, but it'd be smelly. We shouldn't need concurrency for this; something that works like Choreography.Choreo.runChoreo, but with the side-effect of accumulating everyone's views as state, would seem like the "right" way to do it.

psilospore commented 3 months ago

Ah ok thanks for the clarification. I think it should be fairly easy to port this over to state.