Add initial implementation of map()/mapM().