Skip to content
Playground(another site)

bynk.transition.impure_predicate

Error A transition predicate uses an effectful or test-only construct; a step invariant must be pure.

A transition is checked at each commit, over the old and new states, so it may only read: old, new, operators and pure value methods. Effect.pure, ?, expect, Val and the other test-only forms are refused, as is anything that performs an effect. Rewrite the predicate as a plain Bool expression. The mirror rule for states is bynk.invariant.impure_predicate.

Example

transition grows: Effect.pure(new.count >= old.count) // ✗ an effect, not a pure predicate
transition grows: new.count >= old.count // ✓ a plain `Bool` expression

In the Book

See also