pathlib-0.1: A library for safe (file)path manipulationSource codeContentsIndex
Data.Path.Implementation
Synopsis
coerceObject :: Path s p o -> Path s p o'
coerceType :: Path s p o -> Path s p' o
data Posix
data W32
data Directory
data File
data Any
class DirectoryW w
class FileW w
data Absolute
data Relative
data Sub
class SuffixClass x where
type Suffix x :: *
class AbsoluteW w
class RelativeW w
type Name = ByteString
data PathType spec path => Path spec path object = Path ByteString
class PathType spec path where
unpath :: forall object. Path spec path object -> ByteString
path :: forall object. ByteString -> Path spec path object
pathToBS :: forall object. Path spec path object -> ByteString
parsePathBS :: forall object. ByteString -> Maybe (Path spec path object)
parent :: forall dir object. DirectoryW dir => Path spec path object -> Path spec path dir
makeAbsolute :: forall object abs dir. (DirectoryW dir, PathType spec Absolute) => Path spec Absolute dir -> Path spec path object -> Path spec Absolute object
(</>) :: forall obj obj'. PathType spec path => Path spec path obj -> Name -> Path spec path obj'
separators :: forall obj. Path spec path obj -> [Char]
editPath :: PathType a b => Path a b c -> (ByteString -> ByteString) -> Path a b c
root :: PathType spec path => Path spec path object
parse :: forall spec path object. PathType spec path => ByteString -> Path spec path object
relParse :: forall spec path object. PathType spec path => ByteString -> Maybe (Path spec path object)
absParse :: forall spec path object. PathType spec path => ByteString -> Maybe (Path spec path object)
winParse :: forall spec path object. PathType spec path => (ByteString -> Maybe (Path spec path object)) -> ByteString -> Maybe (Path spec path object)
relParent :: (PathType spec rel, DirectoryW dir, RelativeW rel) => Path spec rel object -> Path spec rel dir
absParent :: (PathType spec abs, DirectoryW dir, AbsoluteW abs) => Path spec abs object -> Path spec abs dir
data Split a b
= a :/: b
| Atomic
singleton :: forall spec path object. PathType spec path => Path spec path object -> Maybe ByteString
directory :: forall spec path object rel. (PathType spec path, PathType spec rel, RelativeW rel) => Path spec path object -> Split ByteString (Path spec rel object)
file :: forall spec path dir object. (PathType spec path, PathType spec path, DirectoryW dir) => Path spec path object -> Split (Path spec path dir) ByteString
isRoot :: (PathType spec path, DirectoryW dir) => Path spec path dir -> Bool
isPrefix :: PathType spec path => Path spec path object -> Path spec path object' -> Bool
basename :: forall spec path object. PathType spec path => Path spec path object -> Name
join :: forall spec path obj obj'. PathType spec path => Path spec path obj -> Name -> Path spec path obj'
safeJoin :: forall spec path obj obj'. PathType spec path => Path spec path obj -> Name -> Path spec path obj'
(<.>) :: forall spec path obj. PathType spec path => Path spec path obj -> Name -> Path spec path obj
(+/+) :: forall spec path dir rel object. (PathType spec path, PathType spec rel, RelativeW rel, DirectoryW dir) => Path spec path dir -> Path spec rel object -> Path spec path object
relativeTo :: (PathType spec path, PathType spec rel, RelativeW rel, DirectoryW dir) => Path spec path dir -> Path spec path object -> Maybe (Path spec rel object)
parents :: forall spec abs object dir. (PathType spec abs, AbsoluteW abs, DirectoryW dir) => Path spec abs object -> [Path spec abs dir]
pathToString :: PathType spec path => Path spec path object -> String
parsePath :: PathType spec path => String -> Maybe (Path spec path object)
renamePath :: forall spec path dir object object'. (PathType spec path, PathType spec Relative, DirectoryW dir) => Path spec path dir -> Path spec path dir -> Path spec path object' -> Path spec path object'
eitherPath :: (PathType spec abs, PathType spec rel, AbsoluteW abs, RelativeW rel) => String -> Either (Path spec abs object) (Path spec rel object)
pathInvariants :: PathType a b => Path a b c -> Bool
ioAbsolute :: forall spec path object. (PathType spec Absolute, PathType spec path) => Path spec path object -> IO (Path spec Absolute object)
Documentation
coerceObject :: Path s p o -> Path s p o'Source
coerceType :: Path s p o -> Path s p' oSource
data Posix Source
Posix is the real POSIX paths, where foo/.. can mean something else than .. It is a runtime error to join .. to a POSIX path (by extension, such paths cannot be parsed if they contain .. components). You need to use ioJoin / ioParsePath and related to handle these paths.
data W32 Source
The W32 type represents Windows-style paths.
data Directory Source
data File Source
data Any Source
class DirectoryW w Source
class FileW w Source
data Absolute Source
data Relative Source
data Sub Source
class SuffixClass x Source
Associated Types
type Suffix x :: *Source
Methods
class AbsoluteW w Source
class RelativeW w Source
type Name = ByteStringSource
data PathType spec path => Path spec path object Source
Constructors
Path ByteString
class PathType spec path whereSource
Methods
unpath :: forall object. Path spec path object -> ByteStringSource
path :: forall object. ByteString -> Path spec path objectSource
pathToBS :: forall object. Path spec path object -> ByteStringSource
parsePathBS :: forall object. ByteString -> Maybe (Path spec path object)Source
parent :: forall dir object. DirectoryW dir => Path spec path object -> Path spec path dirSource
makeAbsolute :: forall object abs dir. (DirectoryW dir, PathType spec Absolute) => Path spec Absolute dir -> Path spec path object -> Path spec Absolute objectSource
(</>) :: forall obj obj'. PathType spec path => Path spec path obj -> Name -> Path spec path obj'Source
separators :: forall obj. Path spec path obj -> [Char]Source
editPath :: PathType a b => Path a b c -> (ByteString -> ByteString) -> Path a b cSource
root :: PathType spec path => Path spec path objectSource
parse :: forall spec path object. PathType spec path => ByteString -> Path spec path objectSource
relParse :: forall spec path object. PathType spec path => ByteString -> Maybe (Path spec path object)Source
absParse :: forall spec path object. PathType spec path => ByteString -> Maybe (Path spec path object)Source
winParse :: forall spec path object. PathType spec path => (ByteString -> Maybe (Path spec path object)) -> ByteString -> Maybe (Path spec path object)Source
relParent :: (PathType spec rel, DirectoryW dir, RelativeW rel) => Path spec rel object -> Path spec rel dirSource
absParent :: (PathType spec abs, DirectoryW dir, AbsoluteW abs) => Path spec abs object -> Path spec abs dirSource
data Split a b Source
Constructors
a :/: b
Atomic
singleton :: forall spec path object. PathType spec path => Path spec path object -> Maybe ByteStringSource
directory :: forall spec path object rel. (PathType spec path, PathType spec rel, RelativeW rel) => Path spec path object -> Split ByteString (Path spec rel object)Source
file :: forall spec path dir object. (PathType spec path, PathType spec path, DirectoryW dir) => Path spec path object -> Split (Path spec path dir) ByteStringSource
isRoot :: (PathType spec path, DirectoryW dir) => Path spec path dir -> BoolSource
isPrefix :: PathType spec path => Path spec path object -> Path spec path object' -> BoolSource
Check whether a path is a prefix of another path.
basename :: forall spec path object. PathType spec path => Path spec path object -> NameSource
join :: forall spec path obj obj'. PathType spec path => Path spec path obj -> Name -> Path spec path obj'Source
safeJoin :: forall spec path obj obj'. PathType spec path => Path spec path obj -> Name -> Path spec path obj'Source
(<.>) :: forall spec path obj. PathType spec path => Path spec path obj -> Name -> Path spec path objSource
(+/+) :: forall spec path dir rel object. (PathType spec path, PathType spec rel, RelativeW rel, DirectoryW dir) => Path spec path dir -> Path spec rel object -> Path spec path objectSource
relativeTo :: (PathType spec path, PathType spec rel, RelativeW rel, DirectoryW dir) => Path spec path dir -> Path spec path object -> Maybe (Path spec rel object)Source
parents :: forall spec abs object dir. (PathType spec abs, AbsoluteW abs, DirectoryW dir) => Path spec abs object -> [Path spec abs dir]Source
The list of parent paths. This does not make sense for Relative paths as each relative path has a parent (. -> ..).
pathToString :: PathType spec path => Path spec path object -> StringSource
Turn a path to a String that can be used with traditional String-based filepath code, like System.IO and friends.
parsePath :: PathType spec path => String -> Maybe (Path spec path object)Source
Turn a String into a Path. This may fail, depending on the type of path you requested and the content of the string you passed.
renamePathSource
:: forall spec path dir object object' . (PathType spec path, PathType spec Relative, DirectoryW dir)
=> Path spec path dirFrom: the directory to rename.
-> Path spec path dirTo: the new name of the directory.
-> Path spec path object'The path to project.
-> Path spec path object'
eitherPath :: (PathType spec abs, PathType spec rel, AbsoluteW abs, RelativeW rel) => String -> Either (Path spec abs object) (Path spec rel object)Source
See Data.Path.eitherPath.
pathInvariants :: PathType a b => Path a b c -> BoolSource
Check various path invariants.
ioAbsolute :: forall spec path object. (PathType spec Absolute, PathType spec path) => Path spec path object -> IO (Path spec Absolute object)Source
NB. This is not threadsafe. Turn a relative path (relative to current working directory) into an absolute path.
Produced by Haddock version 2.6.0