runState :: Monad m => (m (), state) -> (state -> m ()) -> StateT state m result -> m result
runState (initM, initialState) done run =
    do
        initM
        (result, finalState) <- runStateT run initialState
        done finalState
        return result
runState :: Monad m => (m (), state) -> (state -> m ()) -> StateT state m result -> m result
runState (initM, initialState) done run =
    do
        initM
        (result, finalState) <- runStateT run initialState
        done finalState
        return result
runState (initM, initialState) done run =
    do
        initM
        (result, finalState) <- runStateT run initialState
        done finalState
        return result