lio-eci11-0.1: Labeled IO library

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.

Synopsis

Documentation

class Monad m => CloseOps h m whereSource

Methods

hClose :: h -> m ()Source

hFlush :: h -> m ()Source

Instances

class CloseOps h m => HandleOps h b m whereSource

Methods

hGet :: h -> Int -> m bSource

hGetNonBlocking :: h -> Int -> m bSource

hGetContents :: h -> m bSource

hPut :: h -> b -> m ()Source

hPutStrLn :: h -> b -> m ()Source

Instances

HandleOps Handle ByteString IO 
(Label l, CloseOps (LHandle l h) (LIO l s), HandleOps h b IO) => HandleOps (LHandle l h) b (LIO l s) 

data LHandle l h Source

Instances

(Label l, CloseOps (LHandle l h) (LIO l s), HandleOps h b IO) => HandleOps (LHandle l h) b (LIO l s) 
Label l => MintTCB (LHandle l Handle) (Handle, l) 
Label l => CloseOps (LHandle l Handle) (LIO l s) 
Label l => DirectoryOps (LHandle l Handle) (LIO l s) 

hlabelOf :: Label l => LHandle l h -> lSource

mkDirSource

Arguments

:: Priv l p 
=> p

Privileges

-> l

Label for the new directory

-> Name l

Start point

-> FilePath

Name to create

-> LIO l s () 

mkLHandleSource

Arguments

:: Priv l p 
=> p

Privileges to minimize taint

-> l

Label if new file is created

-> Name l

Starting point of pathname

-> FilePath

Path of file relative to prev

-> IOMode

Mode of handle

-> LIO l s (LHandle l Handle) 

readFile :: (DirectoryOps h m, HandleOps h b m) => FilePath -> m bSource

createDirectoryPR :: Priv l p => p -> Name l -> FilePath -> LIO l s ()Source

openFilePR :: Priv l p => p -> Name l -> FilePath -> IOMode -> LIO l s (LHandle l Handle)Source

writeFilePR :: (Priv l p, HandleOps Handle b IO) => p -> Name l -> FilePath -> b -> LIO l s ()Source

createDirectoryP :: Priv l p => p -> FilePath -> LIO l s ()Source

openFileP :: Priv l p => p -> FilePath -> IOMode -> LIO l s (LHandle l Handle)Source

writeFileP :: (Priv l p, HandleOps Handle b IO) => p -> FilePath -> b -> LIO l s ()Source

data IOMode

See System.IO.openFile