The Farmer's Dog interview question

How do you construct a promise from scratch?