squeeze-1.0.4.13: A file-packing application.

Safe HaskellNone
LanguageHaskell2010

Squeeze.Data.File

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Defines file-related type-synonyms, and associated operations.

Synopsis

Types

Type-synonyms

type FilePathList = [FilePath] Source #

A type suitable for containing an arbitrary set of file-paths.

type FileSize = Integer Source #

A type-synonym specifically to hold file-sizes (in bytes).

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 FileSizes 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 #

Arguments

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

Predicates

hasSizeBy Source #

Arguments

:: (FileSize -> Bool)

The predicate.

-> FileSizeAndPath

The file-parameters to be tested.

-> Bool 

True if the specified file has the required size according to the specified predicate.