Repository navigation
Where a message can land, as a type - #1
Open
m-bock-agent wants to merge 2 commits into
Open
m-bock-agent wants to merge 2 commits into
m-bock-agent wants to merge 2 commits into
Conversation
- `Transit.Class.Landings` walks the table for one message and computes the row of states it can end in. - `Transit.Apply.mkApply` turns a machine's apply into one that answers with that row, plus `stuck` for everything else. - `Applying` is the wrapper class, so a caller's signature names the specification and the message and nothing about RowToList.
- The walk and `Contractable` move into the instance, so `Applying` is the only thing a caller's signature carries. - The answer is `Either (Variant rowState) (Variant landings)`, not a variant with a `stuck` field: a machine with a state called `stuck` would have made that row carry the label twice.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emitting a message and then asserting "we must be in state X now" is a
runtime throw for something the transition table already knows. This
computes it instead.
Transit.Class.Landingswalks the table for one message andgives back the row of states it can end in. Three arrows labelled
Askedall ending inAskingis one field; a message the tablenever mentions is the empty row.
Transit.Apply.mkApplyturns a machinesapply- a message in, the state it produced out - into one that answers with aVariantof exactly those landings, plusstuck` carrying the whole state.Applyingis the wrapper class, so a caller writes thespecification and the message and nothing about
RowToListor rowarithmetic.
What a caller gets is a
matchwhose branches are the states thismessage can reach, each with its own payload, and no branch for a state
it cannot.
stuckis about where the machine ended up, not about whether an arrowfired: a message with no arrow from the current state leaves it where it
was, and if that state happens to be one of the landings it reads as one.
The spec says so out loud.
Tests: 127/127. The landings assertions are compile-time and each is
forced by a second declaration - a constraint in a signature is not
solved until it is used, so the first four I wrote proved nothing.