bynk.invariant.impure_predicate
Error An invariant predicate uses an effectful or test-only construct.
An invariant is checked at every commit, over the state about to be written, so it may only read: state fields, 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 over the fields. The mirror rule for steps is bynk.transition.impure_predicate.
Example
invariant positive: Effect.pure(count >= 0) // ✗ an effect, not a pure predicate
invariant positive: count >= 0 // ✓ a plain `Bool` expressionIn the Book
See also
- Every code in its category, Other, on the diagnostic index.
bynk explain bynk.invariant.impure_predicateshows the same from the installed toolchain, without a network.