We need to be able to get from an AmbiguousPath (we don’t know if it’s a file or directory) to a Path (where we do know).
There is a commented out
disambiguate :: AmbiguousPath 'Abs PathComponent -> IO (Maybe (Path 'Abs _ PathComponent))
in Filesystem.Path that should look at the filesystem and return an non-ambiguous Path if something exists there, that it can declare is either a Dir or File. There should also be a
disambiguate :: proxy typ -> AmbiguousPath rel rep -> Path rel typ rep
in Data.Path that just “takes our word for it”.
NB: The Filesystem.Path one probably needs to return in a structure like
data Unambiguous rel rep
= Dir (Path rel 'Dir rep)
| File (Path rel 'File rep)
similar to how Data.Path.Anchored is used, so the type would actually be
disambiguate :: AmbiguousPath 'Abs PathComponent -> IO (Maybe (Unambiguous 'Abs PathComponent))