Safe Haskell | None |
---|---|
Language | Haskell2010 |
Some utilities to deal with IO in B9.
- data SystemPath
- resolve :: MonadIO m => SystemPath -> m FilePath
- ensureDir :: MonadIO m => FilePath -> m ()
- getDirectoryFiles :: MonadIO m => FilePath -> m [FilePath]
- prettyPrintToFile :: (MonadIO m, Show a) => FilePath -> a -> m ()
- consult :: (MonadIO m, Read a) => FilePath -> m a
- data ConsultException = ConsultException FilePath String
- randomUUID :: MonadIO m => m UUID
- data UUID
Documentation
data SystemPath Source #
A data type encapsulating different kinds of relative or absolute paths.
Path FilePath | A path that will just be passed through |
InHomeDir FilePath | A OS specific path relative to the home directory of a user. |
InB9UserDir FilePath | A path relative to the |
InTempDir FilePath | A path relative to the systems temporary directory. |
resolve :: MonadIO m => SystemPath -> m FilePath Source #
Convert a SystemPath
to a FilePath
.
ensureDir :: MonadIO m => FilePath -> m () Source #
Create all missing parent directories of a file path.
Note that the file path is assumed to be of a regular file, and
takeDirectory
is applied before creating the directory.
getDirectoryFiles :: MonadIO m => FilePath -> m [FilePath] Source #
Get all files from dir
that is get ONLY files not directories
consult :: (MonadIO m, Read a) => FilePath -> m a Source #
Read a value of a type that is an instance of Read
from a file.
This function throws a ConsultException
when the read the file failed.
data ConsultException Source #