let map f entry =
let rec self entry =
match entry with
| Dir(path, name, st, attr, contents) ->
Dir(path, name, st, f path name attr, lazy (List.map self !*contents))
| File(path, name, st, attr) ->
File(path, name, st, f path name attr)
| Nothing -> Nothing
| Error e -> Error e
in self entry