Lastik-0.6.2: A library for compiling programs in a variety of languages

System.Build.FilePather

Contents

Description

Combinators for finding files recursively. The combinators all surround the find function.

Synopsis

Documentation

data FilePather a Source

A function that takes a FilePath and produces a value.

Constructor and unwrapper

filePather :: (FilePath -> a) -> FilePather aSource

Construct a FilePather from the given function

Values using System.FilePath

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.

Utility

not' :: Functor f => f Bool -> f BoolSource

Inverts the given Bool in a functor.

constant :: Functor f => f a -> f (t -> a)Source

Produces a constant function in a functor.

(==?) :: (Eq a, Functor f) => f a -> a -> f BoolSource

Tests for equality in a functor.

(/=?) :: (Eq a, Functor f) => f a -> a -> f BoolSource

Tests for inequality in a functor.

(==||) :: (Eq a, Functor f, Foldable t) => f a -> t a -> f BoolSource

Tests for equality of any values in the given container.

(/=||) :: (Eq a, Functor f, Foldable t) => f a -> t a -> f BoolSource

Tests for inequality of any values in the given container.

(==&&) :: (Eq a, Functor f, Foldable t) => f a -> t a -> f BoolSource

Tests for equality of all values in the given container.

(/=&&) :: (Eq a, Functor f, Foldable t) => f a -> t a -> f BoolSource

Tests for inequality of all values in the given container.

(==>) :: Applicative f => f Bool -> f Bool -> f BoolSource

Tests for implication in an applicative functor.

(===>) :: (Applicative f1, Applicative f2) => f1 (f2 Bool) -> f1 (f2 Bool) -> f1 (f2 Bool)Source

Tests for implication in an applicative functor in an applicative functor.

(/=>) :: Applicative f => f Bool -> f Bool -> f BoolSource

Tests for inverse implication in an applicative functor.

(/==>) :: (Applicative f1, Applicative f2) => f1 (f2 Bool) -> f1 (f2 Bool) -> f1 (f2 Bool)Source

Tests for inverse implication in an applicative functor in an applicative functor.

(&&?) :: Applicative f => f Bool -> f Bool -> f BoolSource

Performs conjunction (AND) in an applicative functor.

(?&&?) :: (Applicative f1, Applicative f2) => f1 (f2 Bool) -> f1 (f2 Bool) -> f1 (f2 Bool)Source

Performs conjunction (AND) in an applicative functor in an applicative functor.

(||?) :: Applicative f => f Bool -> f Bool -> f BoolSource

Performs disjunction (OR) in an applicative functor.

(?||?) :: (Applicative f1, Applicative f2) => f1 (f2 Bool) -> f1 (f2 Bool) -> f1 (f2 Bool)Source

Performs disjunction (OR) in an applicative functor in an applicative functor.

Find predicates

data FileType Source

The possible types of a file.

Constructors

File

The type is a normal file.

Directory

The type is a directory.

Unknown

The type is unknown.

Instances

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.

Core function

findSource

Arguments

:: 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.