### Question:
ReferenceMonadState implements MonadState<F, S> { @Override public Kind<F, S> get() { return ref.get(); } ReferenceMonadState(Reference<F, S> ref, Monad<F> monad); @Override Kind<F, S> get(); @Override Kind<F, Unit> set(S state); @Override Kind<F, T> pure(T value); @Override Kind<F, R> flatMap(Kind<F, ? extends T> value, Function1<? super T, ? extends Kind<F, ? extends R>> map);  }### Answer:
@Test public void program() { IO<ImmutableArray<String>> result = For.with(monadState) .then(monadState.modify(list -> list.append("a"))) .then(monadState.modify(list -> list.append("b"))) .then(monadState.modify(list -> list.append("c"))) .then(monadState.get()).fix(toIO()); assertEquals(arrayOf("a", "b", "c"), result.unsafeRunSync()); }