Simplify vars and envs#474
Merged
Merged
Conversation
moodmosaic
reviewed
Dec 24, 2025
Member
moodmosaic
left a comment
There was a problem hiding this comment.
Looking forward porting my hello-world example into Hedgehog.Stateful 👀 🥳
Contributor
Author
Member
|
What |
Contributor
Author
|
|
Member
|
Do you have a use case for it? |
Contributor
Author
|
Anything to assess that the state has changed in an expected way (or not changed). Similarly how Haskell version defines. Ensure (state Concrete -> state Concrete -> input Concrete -> output -> Test ()) |
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.
Simplifying
Vars andEnvsInstead of storing values in
Env,Vars now store concrete values:This allows simplifying
Varitself, but also removes the need of reflective state traversal for reporting the state.Justification
In .NET we don't have HKT, so we don't
HTraversebetween symbolic and concrete state anyway. Instead, state always holdsVar<'T>, so there is no need in runtime correlation betweenEnvandVar.This means that during execution stage we can simply create a concrete
Var(with value) and pass it toUpdate.Updatewill still not be able to distinguish between symbolic and concrete variables, as expected.Envis still being received by execution-stage methods (Require,Execute,Ensure) and is still required byVar.Resolvebecause it serves the role of the capability and provides some compile-time safety: if you don't haveEnvyou can't have access to concrete state.Results
With this approach we:
Var(win for maintenance)Report example