LIO.Handle
Description
This module abstracts the basic FileHandle methods provided by
the system library, and provides an LHandle (Labeled Handle) type
that can be manipulated from within the LIO Monad. Two lower
level functions, mkDir and mkLHandle may be useful for
functions that wish to open file names that are not relative to
rootDir. (There is no notion of changeable current working
directory in the LIO Monad.)
The actual storage of labeled files is handled by the LIO.FS module.
- class Monad m => DirectoryOps h m | m -> h where
- getDirectoryContents :: FilePath -> m [FilePath]
- createDirectory :: FilePath -> m ()
- openFile :: FilePath -> IOMode -> m h
- class Monad m => CloseOps h m where
- class CloseOps h m => HandleOps h b m where
- hGet :: h -> Int -> m b
- hGetNonBlocking :: h -> Int -> m b
- hGetContents :: h -> m b
- hPut :: h -> b -> m ()
- hPutStrLn :: h -> b -> m ()
- data LHandle l h
- hlabelOf :: Label l => LHandle l h -> l
- mkDir :: Priv l p => p -> l -> Name l -> FilePath -> LIO l s ()
- mkLHandle :: Priv l p => p -> l -> Name l -> FilePath -> IOMode -> LIO l s (LHandle l Handle)
- readFile :: (DirectoryOps h m, HandleOps h b m) => FilePath -> m b
- writeFile :: (DirectoryOps h m, HandleOps h b m, OnExceptionTCB m) => FilePath -> b -> m ()
- createDirectoryPR :: Priv l p => p -> Name l -> FilePath -> LIO l s ()
- openFilePR :: Priv l p => p -> Name l -> FilePath -> IOMode -> LIO l s (LHandle l Handle)
- writeFilePR :: (Priv l p, HandleOps Handle b IO) => p -> Name l -> FilePath -> b -> LIO l s ()
- createDirectoryP :: Priv l p => p -> FilePath -> LIO l s ()
- openFileP :: Priv l p => p -> FilePath -> IOMode -> LIO l s (LHandle l Handle)
- writeFileP :: (Priv l p, HandleOps Handle b IO) => p -> FilePath -> b -> LIO l s ()
- data IOMode
- = ReadMode
- | WriteMode
- | AppendMode
- | ReadWriteMode
Documentation
class Monad m => DirectoryOps h m | m -> h whereSource
Methods
getDirectoryContents :: FilePath -> m [FilePath]Source
createDirectory :: FilePath -> m ()Source
Instances
| DirectoryOps Handle IO | |
| Label l => DirectoryOps (LHandle l Handle) (LIO l s) |
readFile :: (DirectoryOps h m, HandleOps h b m) => FilePath -> m bSource
writeFile :: (DirectoryOps h m, HandleOps h b m, OnExceptionTCB m) => FilePath -> b -> m ()Source