sophia/test/contracts/code_errors/higher_order_state.aes

8 lines
206 B
Plaintext

contract HigherOrderState =
record state = {f : int => int}
entrypoint init() = {f = (x) => x}
entrypoint apply(n) = state.f(n)
stateful entrypoint inc() = put(state{ f = (x) => state.f(x + 1) })