Turns out the problem was in stateToStateT