stack-2.14.0: The Haskell Tool Stack
Safe HaskellSafe-Inferred
LanguageGHC2021

Path.Find

Description

Finding files.

Synopsis

Documentation

findFileUp Source #

Arguments

:: (MonadIO m, MonadThrow m) 
=> Path Abs Dir

Start here.

-> (Path Abs File -> Bool)

Predicate to match the file.

-> Maybe (Path Abs Dir)

Do not ascend above this directory.

-> m (Maybe (Path Abs File))

Absolute file path.

Find the location of a file matching the given predicate.

findDirUp Source #

Arguments

:: (MonadIO m, MonadThrow m) 
=> Path Abs Dir

Start here.

-> (Path Abs Dir -> Bool)

Predicate to match the directory.

-> Maybe (Path Abs Dir)

Do not ascend above this directory.

-> m (Maybe (Path Abs Dir))

Absolute directory path.

Find the location of a directory matching the given predicate.

findFiles Source #

Arguments

:: Path Abs Dir

Root directory to begin with.

-> (Path Abs File -> Bool)

Predicate to match files.

-> (Path Abs Dir -> Bool)

Predicate for which directories to traverse.

-> IO [Path Abs File]

List of matching files.

Find files matching predicate below a root directory.

NOTE: this skips symbolic directory links, to avoid loops. This may not make sense for all uses of file finding.

TODO: write one of these that traverses symbolic links but efficiently ignores loops.

findInParents :: MonadIO m => (Path Abs Dir -> m (Maybe a)) -> Path Abs Dir -> m (Maybe a) Source #

findInParents f path applies f to path and its parents until it finds a Just or reaches the root directory.