promptLoop is made of pure functions.