lightweight generator/promise utility