4 add type annotation for state monad