add array typecheck to function returned by `generatorOf`
`generatorOf`: do type checking early
add `rest` function