toolshed-0.13.0.0: Utilities used by other packages.

Safe HaskellSafe-Infered

ToolShed.System.File

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
File-operations.

Synopsis

Types

Type-synonyms

type SearchPath = [FilePath]Source

The ordered sequence of directories, searched for a file.

type LocatedData a = (FilePath, a)Source

A file-path, and the contents read from it.

Functions

locate :: FilePath -> SearchPath -> IO [FilePath]Source

  • Locates all instances of the specified file, on the search-path.
  • CAVEAT: invalid or duplicate paths are silently removed.
  • CAVEAT: doesn't perform file-globbing.

getFile :: FilePath -> SearchPath -> IO (LocatedData String)Source

Traverse the search-path, looking for matching instances of the specified file-name, and either throw an exception, or return a pair composed from the path to the first matching file, together with its contents.

fromFile :: Read a => FilePath -> SearchPath -> IO (LocatedData a)Source

  • Returns the polymorphic data, read from the first matching file on the search-path, along with the path from which it was read.
  • Returns an error on failure to parse the contents of the first matching file found on the search-path.

Accessors

getData :: LocatedData a -> aSource

Accessor.