MissingH-1.4.1.0: Large utility library

Copyright | Copyright (C) 2004-2011 John Goerzen
License | BSD3
Maintainer | John Goerzen <jgoerzen@complete.org>
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell98

System.IO.HVFS.InstanceHelpers

Contents

- HVFSStat objects
- HVFS objects & types
  - MemoryVFS
- Utilities

Description

Utilities for creating instances of the items defined in System.IO.HVFS.

Synopsis

- data SimpleStat = SimpleStat {
  - isFile :: Bool
  - fileSize :: FileOffset
  }
- data MemoryVFS
- newMemoryVFS :: [MemoryNode] -> IO MemoryVFS
- newMemoryVFSRef :: IORef [MemoryNode] -> IO MemoryVFS
- type MemoryNode = (String, MemoryEntry)
- data MemoryEntry
  - = MemoryDirectory [MemoryNode]
  - | MemoryFile String
- nice_slice :: String -> [String]
- getFullPath :: HVFS a => a -> String -> IO String
- getFullSlice :: HVFS a => a -> String -> IO [String]

# HVFSStat objects

data SimpleStat Source #

A simple System.IO.HVFS.HVFSStat class that assumes that everything is either a file or a directory.

Constructors

SimpleStat |

Fields

- isFile :: Bool

  True if file, False if directory

- fileSize :: FileOffset

  Set to 0 if unknown or a directory

Instances

Eq SimpleStat Source # |
Instance details Defined in System.IO.HVFS.InstanceHelpers Methods (==) :: SimpleStat -> SimpleStat -> Bool Source # (/=) :: SimpleStat -> SimpleStat -> Bool Source #
Show SimpleStat Source # |
Instance details Defined in System.IO.HVFS.InstanceHelpers Methods showsPrec :: Int -> SimpleStat -> ShowS Source # show :: SimpleStat -> String Source # showList :: [SimpleStat] -> ShowS Source #
HVFSStat SimpleStat Source # |

Instance details

Defined in System.IO.HVFS.InstanceHelpers

Methods

vDeviceID :: SimpleStat -> DeviceID Source #

vFileID :: SimpleStat -> FileID Source #

vFileMode :: SimpleStat -> FileMode Source #

vLinkCount :: SimpleStat -> LinkCount Source #

vFileOwner :: SimpleStat -> UserID Source #

vFileGroup :: SimpleStat -> GroupID Source #

vSpecialDeviceID :: SimpleStat -> DeviceID Source #

vFileSize :: SimpleStat -> FileOffset Source #

vAccessTime :: SimpleStat -> EpochTime Source #

vModificationTime :: SimpleStat -> EpochTime Source #

vStatusChangeTime :: SimpleStat -> EpochTime Source #

vIsBlockDevice :: SimpleStat -> Bool Source #

vIsCharacterDevice :: SimpleStat -> Bool Source #

vIsNamedPipe :: SimpleStat -> Bool Source #

vIsRegularFile :: SimpleStat -> Bool Source #

vIsDirectory :: SimpleStat -> Bool Source #

vIsSymbolicLink :: SimpleStat -> Bool Source #

vIsSocket :: SimpleStat -> Bool Source #

# HVFS objects & types

## MemoryVFS

data MemoryVFS Source #

An in-memory read/write filesystem. Think of it as a dynamically resizable ramdisk written in Haskell.

Instances

Show MemoryVFS Source # |
Instance details Defined in System.IO.HVFS.InstanceHelpers Methods showsPrec :: Int -> MemoryVFS -> ShowS Source # show :: MemoryVFS -> String Source # showList :: [MemoryVFS] -> ShowS Source #
HVFSOpenable MemoryVFS Source # |
Instance details Defined in System.IO.HVFS.InstanceHelpers Methods vOpen :: MemoryVFS -> FilePath -> IOMode -> IO HVFSOpenEncap Source # vReadFile :: MemoryVFS -> FilePath -> IO String Source # vWriteFile :: MemoryVFS -> FilePath -> String -> IO () Source # vOpenBinaryFile :: MemoryVFS -> FilePath -> IOMode -> IO HVFSOpenEncap Source #
HVFS MemoryVFS Source # |

Instance details

Defined in System.IO.HVFS.InstanceHelpers

Methods

vGetCurrentDirectory :: MemoryVFS -> IO FilePath Source #

vSetCurrentDirectory :: MemoryVFS -> FilePath -> IO () Source #

vGetDirectoryContents :: MemoryVFS -> FilePath -> IO [FilePath] Source #

vDoesFileExist :: MemoryVFS -> FilePath -> IO Bool Source #

vDoesDirectoryExist :: MemoryVFS -> FilePath -> IO Bool Source #

vDoesExist :: MemoryVFS -> FilePath -> IO Bool Source #

vCreateDirectory :: MemoryVFS -> FilePath -> IO () Source #

vRemoveDirectory :: MemoryVFS -> FilePath -> IO () Source #

vRenameDirectory :: MemoryVFS -> FilePath -> FilePath -> IO () Source #

vRemoveFile :: MemoryVFS -> FilePath -> IO () Source #

vRenameFile :: MemoryVFS -> FilePath -> FilePath -> IO () Source #

vGetFileStatus :: MemoryVFS -> FilePath -> IO HVFSStatEncap Source #

vGetSymbolicLinkStatus :: MemoryVFS -> FilePath -> IO HVFSStatEncap Source #

vGetModificationTime :: MemoryVFS -> FilePath -> IO ClockTime Source #

vRaiseError :: MemoryVFS -> IOErrorType -> String -> Maybe FilePath -> IO c Source #

vCreateSymbolicLink :: MemoryVFS -> FilePath -> FilePath -> IO () Source #

vReadSymbolicLink :: MemoryVFS -> FilePath -> IO FilePath Source #

vCreateLink :: MemoryVFS -> FilePath -> FilePath -> IO () Source #

newMemoryVFS :: [MemoryNode] -> IO MemoryVFS Source #

Create a new `MemoryVFS` object from an existing tree. An empty filesystem may be created by using `[]` for the parameter.

newMemoryVFSRef :: IORef [MemoryNode] -> IO MemoryVFS Source #

Create a new `MemoryVFS` object using an IORef to an existing tree.

type MemoryNode = (String, MemoryEntry) Source #

The basic node of a `MemoryVFS`. The String corresponds to the filename, and the entry to the contents.

data MemoryEntry Source #

The content of a file or directory in a `MemoryVFS`.

Constructors

MemoryDirectory [MemoryNode] |
MemoryFile String |

Instances

Eq MemoryEntry Source # |
Instance details Defined in System.IO.HVFS.InstanceHelpers Methods (==) :: MemoryEntry -> MemoryEntry -> Bool Source # (/=) :: MemoryEntry -> MemoryEntry -> Bool Source #
Show MemoryEntry Source # |
Instance details Defined in System.IO.HVFS.InstanceHelpers Methods showsPrec :: Int -> MemoryEntry -> ShowS Source # show :: MemoryEntry -> String Source # showList :: [MemoryEntry] -> ShowS Source #

# Utilities

nice_slice :: String -> [String] Source #

Similar to `NameManip` but the first element won't be `/`.

    nice_slice "/" -> []
    nice_slice "/foo/bar" -> ["foo", "bar"]

getFullPath :: HVFS a => a -> String -> IO String Source #

Gets a full path, after investigating the cwd.

getFullSlice :: HVFS a => a -> String -> IO [String] Source #

Gets the full path via `getFullPath`, then splits it via `nice_slice`.