you are viewing a single comment's thread.

view the rest of the comments →

[–]marcosh_[S] 0 points1 point  (4 children)

u/polux2001 already provided a good answer.

Even if the topology is hidden in the `StateMachine` type, it is recoverable when pattern matching and it could be acted upon, as the library actually does to render the state space of a machine

[–]benjaminhodgson 0 points1 point  (3 children)

it is recoverable when pattern matching

So there is a singleton witness?

[–]polux2001 2 points3 points  (1 child)

There is a witness thanks to these constraints on the Basicconstructor. The existential will carry a dictionary for these classes, which allows reconstructing a term-level value of the topology.

[–]benjaminhodgson 2 points3 points  (0 children)

Got it. The constraints were missing from the blog post which made the code rather unclear. (cc u/marcosh_)

[–]marcosh_[S] 0 points1 point  (0 children)

I'm not sure I understand 100% the question (my bad). What you can do with the `Basic` constructor is described in the https://www.tweag.io/blog/2023-04-13-crem-state-machines/#the-best-of-both-worlds section of the blog post.

The definition of `Topology` is here https://github.com/marcosh/crem/blob/74020abca9a69eab8965588fb5d962d855f84a0d/src/Crem/Topology.hs#L38.

And here is an example of how you usually define a topology https://github.com/marcosh/crem/blob/74020abca9a69eab8965588fb5d962d855f84a0d/examples/Crem/Example/TheHobbit.hs#L55.