Safe Haskell | Safe-Infered |
---|
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- File-operations.
- type SearchPath = [FilePath]
- type LocatedData a = (FilePath, a)
- locate :: FilePath -> SearchPath -> IO [FilePath]
- getFile :: FilePath -> SearchPath -> IO (LocatedData String)
- fromFile :: Read a => FilePath -> SearchPath -> IO (LocatedData a)
- getFilePath :: LocatedData a -> FilePath
- getData :: LocatedData a -> a
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
getFilePath :: LocatedData a -> FilePathSource
Accessor.
getData :: LocatedData a -> aSource
Accessor.