Skip to content

Project var state#473

Merged
AlexeyRaga merged 5 commits into
masterfrom
project-var-state
Dec 23, 2025
Merged

Project var state#473
AlexeyRaga merged 5 commits into
masterfrom
project-var-state

Conversation

@AlexeyRaga
Copy link
Copy Markdown
Contributor

@AlexeyRaga AlexeyRaga commented Dec 23, 2025

1. Allow projecting state

// Project individual fields from the Execution output
override _.Update(state, input, outputVar) =
    { Name = output |> Var.map _.Name
      Age  = output |> Var.map _.Age }

2. Report state better

When the state contains Vars:

public record CounterState
{
    public required Var<int> CurrentCount { get; init; }
}

Resolved values are shown in the error report:

Counterexamples:
  Initial state: CounterState { CurrentCount = 0 }
  + Reset 
  Set 21
  AddRandom 
  Failed at state: CounterState { CurrentCount = 21 }

Comment thread src/Hedgehog.Stateful/Hedgehog.Stateful.fsproj Outdated
@AlexeyRaga AlexeyRaga merged commit 9635160 into master Dec 23, 2025
2 checks passed
@AlexeyRaga AlexeyRaga deleted the project-var-state branch December 23, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants