hashed-storage-0.3.7: Hashed file storage support code.Source codeContentsIndex
Storage.Hashed.AnchoredPath
Contents
Unsafe functions.
Description
This module implements relative paths within a Tree. All paths are anchored at a certain root (this is usually the Tree root). They are represented by a list of Names (these are just strict bytestrings).
Synopsis
newtype Name = Name ByteString
newtype AnchoredPath = AnchoredPath [Name]
appendPath :: AnchoredPath -> Name -> AnchoredPath
anchorPath :: FilePath -> AnchoredPath -> FilePath
isPrefix :: AnchoredPath -> AnchoredPath -> Bool
parent :: AnchoredPath -> AnchoredPath
parents :: AnchoredPath -> [AnchoredPath]
catPaths :: AnchoredPath -> AnchoredPath -> AnchoredPath
flatten :: AnchoredPath -> ByteString
makeName :: String -> Name
nameToFilePath :: Name -> FilePath
nameFromFilePath :: FilePath -> Name
floatBS :: ByteString -> AnchoredPath
floatPath :: FilePath -> AnchoredPath
Documentation
newtype Name Source
Constructors
Name ByteString
show/hide Instances
newtype AnchoredPath Source
Constructors
AnchoredPath [Name]
show/hide Instances
appendPath :: AnchoredPath -> Name -> AnchoredPathSource
Append an element to the end of a path.
anchorPath :: FilePath -> AnchoredPath -> FilePathSource
Take a root directory and an anchored path and produce a full FilePath. Moreover, you can use anchorPath "" to get a relative FilePath.
isPrefix :: AnchoredPath -> AnchoredPath -> BoolSource
Check whether a path is a prefix of another path.
parent :: AnchoredPath -> AnchoredPathSource
Get parent (path) of a given path. foobarbaz -> foo/bar
parents :: AnchoredPath -> [AnchoredPath]Source
List all parents of a given path. foobarbaz -> [foo, foo/bar]
catPaths :: AnchoredPath -> AnchoredPath -> AnchoredPathSource
Catenate two paths together. Not very safe, but sometimes useful (e.g. when you are representing paths relative to a different point than a Tree root).
flatten :: AnchoredPath -> ByteStringSource
makeName :: String -> NameSource
Unsafe functions.
nameToFilePath :: Name -> FilePathSource
Unsafe.
nameFromFilePath :: FilePath -> NameSource
Unsafe.
floatBS :: ByteString -> AnchoredPathSource
floatPath :: FilePath -> AnchoredPathSource
Take a relative FilePath and turn it into an AnchoredPath. The operation is unsafe and if you break it, you keep both pieces. More useful for exploratory purposes (ghci) than for serious programming.
Produced by Haddock version 2.4.2