toolshed-0.17.0.2: Ill-defined library.

Safe HaskellSafe
LanguageHaskell2010

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 #

  • When supplied with an absolute file-path, the search-path is ignored and an exception is thrown if either the file-path is invalid or the file doesn't exist.
  • If the specified file-name is relative, all matching instances on the specified search-path are returned.
  • 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 -> a Source #

Accessor.