FileSystem-1.0.0: File system data structure and monad transformer.

System.FileSystem.Types

Contents

Synopsis

Synonyms

type InApp a = a -> aSource

Internal Application: An application from somewhere over itself.

type DirName = StringSource

A name for a directory.

type FileName = StringSource

A name for a file.

type FileCnt = ByteStringSource

The content of a file. Stored in a ByteString.

type DirPath = [DirName]Source

A list-based directory path.

toDirPath :: FilePath -> DirPathSource

Translation between FilePath and DirPath.

fromDirPath :: DirPath -> FilePathSource

Translation between DirPath and FilePath.

type FPath = (DirPath, FileName)Source

A file path, composed by the path of the directory which contains it, and its file name.

toFPath :: FilePath -> FPathSource

Translation between FilePath and FPath.

fromFPath :: FPath -> FilePathSource

Translation between FPath and FilePath.

File

data FileData Source

Information about the content of a file.

Constructors

FD 

emptyFD :: FileDataSource

An empty file data.

data File Source

A complete file.

Constructors

File 

Fields

getFD :: FileData
 
getFN :: FileName
 

Instances

File System

type FSE = Either (DirName, FileSystem) FileSource

File System Element: Each one of the elements in a FileSystem.

newtype FileSystem Source

The file system structure. It stores a directory with files and subdirectories.

Constructors

Directory 

Fields

dirCnt :: [FSE]
 

emptyFileSystem :: FileSystemSource

An empty file system.

modDirCnt :: InApp [FSE] -> InApp FileSystemSource

Lift a function over a list of FSE (File System Elements) to a function over FileSystem.

Path

data Path Source

A path to a possible File.

Constructors

Path 

isFilePath :: Path -> BoolSource

Check if a Path contents a File.

FileSystem monad

type FSState = FileSystemSource

The state of file system computations.

Currently, a FileSystem structure.

newtype FST m a Source

Monadic transformer which adds a FSState environment.

Constructors

WrapFST 

Fields

unwrapFST :: StateT FSState m a
 

Instances

MonadTrans FST 
Monad m => Monad (FST m) 
Functor m => Functor (FST m) 
MonadIO m => MonadIO (FST m) 
(Functor m, Monad m) => FSMonad (FST m) 

runFST :: Monad m => FST m a -> FSState -> m (a, FSState)Source

Run an FST computation, given an initial state.

type FS = FST IdentitySource

Application of the FST monad transformer to the Identity monad.

runFS :: FS a -> FSState -> (a, FSState)Source

Just a composition of runIdentity and runFST.