only support generator functions