Skip to content

Relax simulate to require StateReader and add simulateWith overload#8

Merged
ghostdogpr merged 4 commits intoghostdogpr:masterfrom
teraha-dev:relax-simulate-state-reader
Mar 30, 2026
Merged

Relax simulate to require StateReader and add simulateWith overload#8
ghostdogpr merged 4 commits intoghostdogpr:masterfrom
teraha-dev:relax-simulate-state-reader

Conversation

@teraha-dev
Copy link
Copy Markdown
Contributor

Logic.simulate only calls get on the outer state, which already accepts StateReader[S]. Relaxing the requirement from State[S] to StateReader[S] allows using simulate in read-only contexts. This is non-breaking since State[S] extends StateReader[S].

Also adds a simulateWith(mockState) overload that reuses the outer Reader[R], which is a common pattern when only the state needs to be mocked.

@ghostdogpr ghostdogpr merged commit b896f6d into ghostdogpr:master Mar 30, 2026
3 checks passed
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