Add readDir primop

supersedes #235
Indentation is off here.