Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Defines file-related type-synonyms, and associated operations.
Synopsis
- type FilePathList = [FilePath]
- type FileSize = Integer
- type FileSizeAndPath = (FileSize, FilePath)
- accumulateSize :: [FileSizeAndPath] -> [FileSize]
- aggregateSize :: [FileSizeAndPath] -> FileSize
- findDuplicates :: FilePathList -> IO FilePathList
- findSizes :: FilePathList -> IO [FileSizeAndPath]
- orderByIncreasingSize :: [FileSizeAndPath] -> [FileSizeAndPath]
- orderByDecreasingSize :: [FileSizeAndPath] -> [FileSizeAndPath]
- getFileSizeStatistics :: (Fractional mean, Floating standardDeviation) => [FileSizeAndPath] -> (Int, FileSize, mean, standardDeviation)
- selectSuitableFileSizes :: (FileSize -> Bool) -> [FileSizeAndPath] -> Writer [String] [FileSizeAndPath]
- getSize :: FileSizeAndPath -> FileSize
- getPath :: FileSizeAndPath -> FilePath
- hasSizeBy :: (FileSize -> Bool) -> FileSizeAndPath -> Bool
Types
Type-synonyms
type FilePathList = [FilePath] Source #
A type suitable for containing an arbitrary set of file-paths.
type FileSizeAndPath = (FileSize, FilePath) Source #
A type suitable for containing a file-path, qualified by the corresponding FileSize
.
Functions
accumulateSize :: [FileSizeAndPath] -> [FileSize] Source #
- Returns the cumulative sequence of sizes, as each file is prepended to the specified list.
- CAVEAT: the list-length is one greater than that supplied, since the last element represents the size with zero files.
aggregateSize :: [FileSizeAndPath] -> FileSize Source #
Sum the FileSize
s in the specified list.
findDuplicates :: FilePathList -> IO FilePathList Source #
- Finds any file-paths which have been specified more than once.
- This includes files which have been implicitly specified via a directory.
findSizes :: FilePathList -> IO [FileSizeAndPath] Source #
Finds file-sizes.
orderByIncreasingSize :: [FileSizeAndPath] -> [FileSizeAndPath] Source #
Sorts a list of FileSizeAndPath
by increasing size; ie. smallest first.
orderByDecreasingSize :: [FileSizeAndPath] -> [FileSizeAndPath] Source #
Sorts a list of FileSizeAndPath
by decreasing size; ie. smallest first.
getFileSizeStatistics Source #
:: (Fractional mean, Floating standardDeviation) | |
=> [FileSizeAndPath] | |
-> (Int, FileSize, mean, standardDeviation) | (Number of components, Aggregate size, Mean size, Standard-deviation). |
Acquire statistics related to a list of files.
selectSuitableFileSizes :: (FileSize -> Bool) -> [FileSizeAndPath] -> Writer [String] [FileSizeAndPath] Source #
- Partitions the specified list of file-sizes & paths, into those whose size is suitable according to the specified predicate & those which are unsuitable.
- Logs the results.
Accessors
getSize :: FileSizeAndPath -> FileSize Source #
Accessor.
getPath :: FileSizeAndPath -> FilePath Source #
Accessor.