- data FilePather a
- (<?>) :: FilePather a -> FilePath -> a
- filePather :: (FilePath -> a) -> FilePather a
- filePath :: FilePather FilePath
- always :: FilePather Bool
- always' :: FilePather (a -> Bool)
- never :: FilePather Bool
- never' :: FilePather (a -> Bool)
- extension :: FilePather FilePath
- extension' :: FilePather (a -> FilePath)
- directory :: FilePather FilePath
- directory' :: FilePather (a -> FilePath)
- hasExtension :: FilePather Bool
- hasExtension' :: FilePather (a -> Bool)
- splitExtension :: FilePather (String, String)
- splitExtension' :: FilePather (a -> (String, String))
- splitDirectories :: FilePather [FilePath]
- splitDirectories' :: FilePather (a -> [FilePath])
- hasTrailingPathSeparator :: FilePather Bool
- hasTrailingPathSeparator' :: FilePather (a -> Bool)
- fileName :: FilePather FilePath
- fileName' :: FilePather (a -> FilePath)
- baseName :: FilePather FilePath
- baseName' :: FilePather (a -> FilePath)
- normalise :: FilePather FilePath
- normalise' :: FilePather (a -> FilePath)
- makeValid :: FilePather FilePath
- makeValid' :: FilePather (a -> FilePath)
- isRelative :: FilePather Bool
- isRelative' :: FilePather (a -> Bool)
- isAbsolute :: FilePather Bool
- isAbsolute' :: FilePather (a -> Bool)
- isValid :: FilePather Bool
- isValid' :: FilePather (a -> Bool)
- data FileType
- type RecursePredicate = FilePather Bool
- type FilterPredicate = FilePather (FileType -> Bool)
- isFile :: Applicative f => f (FileType -> Bool)
- isDirectory :: Applicative f => f (FileType -> Bool)
- isUnknown :: Applicative f => f (FileType -> Bool)
- find :: RecursePredicate -> FilterPredicate -> FilePath -> IO [FilePath]
- extensionSatisfies :: (FilePath -> Bool) -> FilterPredicate
- extensionOneOf :: [FilePath] -> FilterPredicate
- extensionEq :: FilePath -> FilterPredicate
- findHere :: RecursePredicate -> FilterPredicate -> IO [FilePath]
- indir :: FilePath -> (FilePath -> IO a) -> IO a
- indir' :: FilePath -> IO a -> IO a
Data type
data FilePather a Source
A function that takes a FilePath
and produces a value.
Constructor and unwrapper
(<?>) :: FilePather a -> FilePath -> aSource
filePather :: (FilePath -> a) -> FilePather aSource
Construct a FilePather
from the given function
FilePather
values
filePath :: FilePather FilePathSource
A value that runs the identity function.
always :: FilePather BoolSource
A value that always produces the value True
.
always' :: FilePather (a -> Bool)Source
A value using a constant function that produces the value True
.
never :: FilePather BoolSource
A value that always produces the value False
.
never' :: FilePather (a -> Bool)Source
A value that always produces a constant function that produces the value False
.
extension :: FilePather FilePathSource
A value that produces the extension of the given FilePath
.
extension' :: FilePather (a -> FilePath)Source
A value using a constant function that produces the extension of the given FilePath
.
directory :: FilePather FilePathSource
A value that produces the directory of the given FilePath
.
directory' :: FilePather (a -> FilePath)Source
A value using a constant function that produces the directory of the given FilePath
.
hasExtension :: FilePather BoolSource
A value that produces a value denoting whether or not the given FilePath
has an extension.
hasExtension' :: FilePather (a -> Bool)Source
A value using a constant function that produces a value denoting whether or not the given FilePath
has an extension.
splitExtension :: FilePather (String, String)Source
A value that produces a value splitting the given FilePath
by its extension.
splitExtension' :: FilePather (a -> (String, String))Source
A value using a constant function that produces a value splitting the given FilePath
by its extension.
splitDirectories :: FilePather [FilePath]Source
A value that produces a value splitting the given FilePath
into its directories.
splitDirectories' :: FilePather (a -> [FilePath])Source
A value using a constant function that produces a value splitting the given FilePath
into its directories.
hasTrailingPathSeparator :: FilePather BoolSource
A value that produces a value denoting whether or not the given FilePath
has a trailing path separator.
hasTrailingPathSeparator' :: FilePather (a -> Bool)Source
A value using a constant function that produces a value denoting whether or not the given FilePath
has a trailing path separator.
fileName :: FilePather FilePathSource
A value that produces the file name of the given FilePath
.
fileName' :: FilePather (a -> FilePath)Source
A value using a constant function that produces the file name of the given FilePath
.
baseName :: FilePather FilePathSource
A value that produces the base name of the given FilePath
.
baseName' :: FilePather (a -> FilePath)Source
A value using a constant function that produces the base name of the given FilePath
.
normalise :: FilePather FilePathSource
A value that normalises the given FilePath
.
normalise' :: FilePather (a -> FilePath)Source
A value using a constant function that normalises the given FilePath
.
makeValid :: FilePather FilePathSource
A value that makes valid the given FilePath
.
makeValid' :: FilePather (a -> FilePath)Source
A value using a constant function that makes valid the given FilePath
.
isRelative :: FilePather BoolSource
A value that produces a value denoting whether or not the given FilePath
has is relative.
isRelative' :: FilePather (a -> Bool)Source
A value using a constant function that produces a value denoting whether or not the given FilePath
has is relative.
isAbsolute :: FilePather BoolSource
A value that produces a value denoting whether or not the given FilePath
has is absolute.
isAbsolute' :: FilePather (a -> Bool)Source
A value using a constant function that produces a value denoting whether or not the given FilePath
has is absolute.
isValid :: FilePather BoolSource
A value that produces a value denoting whether or not the given FilePath
has is valid.
isValid' :: FilePather (a -> Bool)Source
A value using a constant function that produces a value denoting whether or not the given FilePath
has is valid.
Find predicates
The possible types of a file.
type RecursePredicate = FilePather BoolSource
A recurse predicate takes a FilePath
and returns whether or not to continue recursing on that file.
type FilterPredicate = FilePather (FileType -> Bool)Source
A filter predicate takes a FilePath
and a file type and returns whether or not to filter the value.
isFile :: Applicative f => f (FileType -> Bool)Source
Compares for equivalence to a File
in an applicative functor.
isDirectory :: Applicative f => f (FileType -> Bool)Source
Compares for equivalence to a Directory
in an applicative functor.
isUnknown :: Applicative f => f (FileType -> Bool)Source
Compares for equivalence to Unknown
in an applicative functor.
Find
:: RecursePredicate | The recurse predicate determines whether to continue recursing on the given file path. |
-> FilterPredicate | The filter predicate determines whether to keep the current file path. |
-> FilePath | The file path to begin finding files. |
-> IO [FilePath] | All files found. |
Finds all files using the given recurse predicate and filter predicate in the given file path.
Combinators
extensionSatisfies :: (FilePath -> Bool) -> FilterPredicateSource
Returns a filter predicate based on whether a file extension satisfies a predicate.
extensionOneOf :: [FilePath] -> FilterPredicateSource
Returns a filter predicate based on whether a file extension is one of the given list of extensions.
extensionEq :: FilePath -> FilterPredicateSource
Returns a filter predicate based on whether a file extension equals the given extension.
:: RecursePredicate | The recurse predicate determines whether to continue recursing on the given file path. |
-> FilterPredicate | The filter predicate determines whether to keep the current file path. |
-> IO [FilePath] | All files found. |
Find in the current directory.
:: FilePath | The directory to switch to. |
-> (FilePath -> IO a) | The action to run after being given the current directory. |
-> IO a | The result of running the action in the switched directory. |
Switches to the given directory, runs the given action by passing the current directory and running in the switched directory, then returns to the current directory. The directory is switched back, even if an exception occurs during execution of the action.
| This is useful to run a script in a different directory without switching to it and back again.
:: FilePath | The directory to switch to. |
-> IO a | The action to run. |
-> IO a | The result of running the action in the switched directory. |
Switches to the given directory, runs the given action and running in the switched directory, then returns to the current directory. The directory is switched back, even if an exception occurs during execution of the action.
| This is useful to run a script in a different directory without switching to it and back again.