Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides a data type for representing directories/files @@ -10,25 +10,25 @@ window.onload = function () {pageLoad();setSynopsis("mini_HSFM-FileSystem-FileTy happening on filesystem level.
If you interact with low-level libraries, you must not pattern
match on the `File a` type. Instead, you should only use the saved
path
and make no assumptions about the file the path might or
- might not point to.
- data File a
- data FileInfo = FileInfo {
- deviceID :: !DeviceID
- fileID :: !FileID
- fileMode :: !FileMode
- linkCount :: !LinkCount
- fileOwner :: !UserID
- fileGroup :: !GroupID
- specialDeviceID :: !DeviceID
- fileSize :: !FileOffset
- accessTime :: !EpochTime
- modificationTime :: !EpochTime
- statusChangeTime :: !EpochTime
- accessTimeHiRes :: !POSIXTime
- modificationTimeHiRes :: !POSIXTime
- statusChangeTimeHiRes :: !POSIXTime
- sfileLike :: File FileInfo -> (Bool, File FileInfo)
- fileLike :: File FileInfo -> (Bool, File FileInfo)
- sdir :: File FileInfo -> (Bool, File FileInfo)
- pattern FileLike :: File FileInfo -> File FileInfo
- pattern DirList :: forall t. (Foldable t, Functor t) => t (File FileInfo) -> t (File FileInfo)
- pattern FileLikeList :: forall t. (Foldable t, Functor t) => t (File FileInfo) -> t (File FileInfo)
- brokenSymlink :: File FileInfo -> (Bool, File FileInfo)
- fileLikeSym :: File FileInfo -> (Bool, File FileInfo)
- dirSym :: File FileInfo -> (Bool, File FileInfo)
- pattern FileLikeSym :: File FileInfo -> File FileInfo
- pattern BrokenSymlink :: File FileInfo -> File FileInfo
- pattern DirOrSym :: File FileInfo -> File FileInfo
- pattern DirSym :: File FileInfo -> File FileInfo
- pattern FileLikeOrSym :: File FileInfo -> File FileInfo
- readFile :: (Path Abs -> IO a) -> Path Abs -> IO (File a)
- readDirectoryContents :: (Path Abs -> IO a) -> Path Abs -> IO [File a]
- getContents :: (Path Abs -> IO a) -> File FileInfo -> IO [File a]
- goUp :: File FileInfo -> IO (File FileInfo)
- goUp' :: Path Abs -> IO (File FileInfo)
- anyFailed :: [File a] -> Bool
- successful :: [File a] -> Bool
- failed :: File a -> Bool
- failures :: [File a] -> [File a]
- comparingConstr :: File FileInfo -> File FileInfo -> Ordering
- isFileC :: File a -> Bool
- isDirC :: File a -> Bool
- isSymC :: File a -> Bool
- isBlockC :: File a -> Bool
- isCharC :: File a -> Bool
- isNamedC :: File a -> Bool
- isSocketC :: File a -> Bool
- getFileInfo :: Path Abs -> IO FileInfo
- handleDT :: Path Abs -> IO (File a) -> IO (File a)
- isBrokenSymlink :: File FileInfo -> Bool
- packModTime :: File FileInfo -> String
- packAccessTime :: File FileInfo -> String
- epochToString :: EpochTime -> String
- packPermissions :: File FileInfo -> String
- packFileType :: File a -> String
- packLinkDestination :: File a -> Maybe ByteString
- fromFreeVar :: Default d => (a -> d) -> File a -> d
- getFPasStr :: File a -> String
- getFreeVar :: File a -> Maybe a
Documentation
- data File a
- data FileInfo = FileInfo {
- deviceID :: !DeviceID
- fileID :: !FileID
- fileMode :: !FileMode
- linkCount :: !LinkCount
- fileOwner :: !UserID
- fileGroup :: !GroupID
- specialDeviceID :: !DeviceID
- fileSize :: !FileOffset
- accessTime :: !EpochTime
- modificationTime :: !EpochTime
- statusChangeTime :: !EpochTime
- accessTimeHiRes :: !POSIXTime
- modificationTimeHiRes :: !POSIXTime
- statusChangeTimeHiRes :: !POSIXTime
- sfileLike :: File FileInfo -> (Bool, File FileInfo)
- fileLike :: File FileInfo -> (Bool, File FileInfo)
- sdir :: File FileInfo -> (Bool, File FileInfo)
- pattern FileLike :: File FileInfo -> File FileInfo
- pattern DirList :: () => (Functor t, Foldable t) => t (File FileInfo) -> t (File FileInfo)
- pattern FileLikeList :: () => (Functor t, Foldable t) => t (File FileInfo) -> t (File FileInfo)
- brokenSymlink :: File FileInfo -> (Bool, File FileInfo)
- fileLikeSym :: File FileInfo -> (Bool, File FileInfo)
- dirSym :: File FileInfo -> (Bool, File FileInfo)
- pattern FileLikeSym :: File FileInfo -> File FileInfo
- pattern BrokenSymlink :: File FileInfo -> File FileInfo
- pattern DirOrSym :: File FileInfo -> File FileInfo
- pattern DirSym :: File FileInfo -> File FileInfo
- pattern FileLikeOrSym :: File FileInfo -> File FileInfo
- readFile :: (Path Abs -> IO a) -> Path Abs -> IO (File a)
- readDirectoryContents :: (Path Abs -> IO a) -> Path Abs -> IO [File a]
- getContents :: (Path Abs -> IO a) -> File FileInfo -> IO [File a]
- goUp :: File FileInfo -> IO (File FileInfo)
- goUp' :: Path Abs -> IO (File FileInfo)
- anyFailed :: [File a] -> Bool
- successful :: [File a] -> Bool
- failed :: File a -> Bool
- failures :: [File a] -> [File a]
- comparingConstr :: File FileInfo -> File FileInfo -> Ordering
- isFileC :: File a -> Bool
- isDirC :: File a -> Bool
- isSymC :: File a -> Bool
- isBlockC :: File a -> Bool
- isCharC :: File a -> Bool
- isNamedC :: File a -> Bool
- isSocketC :: File a -> Bool
- getFileInfo :: Path Abs -> IO FileInfo
- handleDT :: Path Abs -> IO (File a) -> IO (File a)
- isBrokenSymlink :: File FileInfo -> Bool
- packModTime :: File FileInfo -> String
- packAccessTime :: File FileInfo -> String
- epochToString :: EpochTime -> String
- packPermissions :: File FileInfo -> String
- packFileType :: File a -> String
- packLinkDestination :: File a -> Maybe ByteString
- fromFreeVar :: Default d => (a -> d) -> File a -> d
- getFPasStr :: File a -> String
- getFreeVar :: File a -> Maybe a
Documentation
The String in the path field is always a full path. The free type variable is used in the File/Dir constructor and can hold Handles, Strings representing a file's contents or anything else you can - think of. We catch any IO errors in the Failed constructor.
pattern FileLike :: File FileInfo -> File FileInfo Source
Matches on any non-directory kind of files, excluding symlinks.
pattern DirList :: () => (Functor t, Foldable t) => t (File FileInfo) -> t (File FileInfo) Source
Matches a list of directories or symlinks pointing to directories.
pattern FileLikeList :: () => (Functor t, Foldable t) => t (File FileInfo) -> t (File FileInfo) Source
Matches a list of any non-directory kind of files or symlinks + pointing to such.
pattern FileLikeSym :: File FileInfo -> File FileInfo Source
Matches on symlinks pointing to file-like files only.
pattern DirOrSym :: File FileInfo -> File FileInfo Source
Matches on directories or symlinks pointing to directories. If the symlink is pointing to a symlink pointing to a directory, then it will return True, but also return the first element in the symlink- - chain, not the last.
pattern DirSym :: File FileInfo -> File FileInfo Source #
Matches on symlinks pointing to directories only.
pattern FileLikeOrSym :: File FileInfo -> File FileInfo Source #
Matches on any non-directory kind of files or symlinks pointing to + chain, not the last.
pattern DirSym :: File FileInfo -> File FileInfo Source
Matches on symlinks pointing to directories only.
pattern FileLikeOrSym :: File FileInfo -> File FileInfo Source
Matches on any non-directory kind of files or symlinks pointing to such. If the symlink is pointing to a symlink pointing to such a file, then it will return True, but also return the first element in the symlink- - chain, not the last.
readFile :: (Path Abs -> IO a) -> Path Abs -> IO (File a) Source #
Reads a file or directory Path into an AnchoredFile
, filling the free
- variables via the given function.
readDirectoryContents Source #
Get the contents of a given directory and return them as a list
- of AnchoredFile
.
getContents :: (Path Abs -> IO a) -> File FileInfo -> IO [File a] Source #
A variant of readDirectoryContents
where the second argument
- is a File
. If a non-directory is passed returns an empty list.
goUp :: File FileInfo -> IO (File FileInfo) Source #
Go up one directory in the filesystem hierarchy.
successful :: [File a] -> Bool Source #
True if there are no Failed constructors in the tree.
getFileInfo :: Path Abs -> IO FileInfo Source #
Gets all file information.
isBrokenSymlink :: File FileInfo -> Bool Source #
Checks if a symlink is broken by examining the constructor of the - symlink destination.
When called on a non-symlink, returns False.
epochToString :: EpochTime -> String Source #
packPermissions :: File FileInfo -> String Source #
Pack the permissions into a string, similar to what "ls -l" does.
packFileType :: File a -> String Source #
packLinkDestination :: File a -> Maybe ByteString Source #
fromFreeVar :: Default d => (a -> d) -> File a -> d Source #
Apply a function on the free variable. If there is no free variable
- for the given constructor the value from the Default
class is used.
getFPasStr :: File a -> String Source #