Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- pairs :: [a] -> [(a, a)]
- unpairs :: Eq a => [(a, a)] -> [a]
- root :: FilePath
- dot :: FilePath
- dotdot :: FilePath
- reduceFilePath :: FilePath -> FilePath
- absoluteLink :: FilePath -> FilePath -> FilePath -> FilePath
- relativeLink :: FilePath -> FilePath -> FilePath -> FilePath
- compElems :: Eq a => [a] -> [a] -> ([a], [a], [a])
- subdirectories :: FilePath -> FilePath -> Bool
- subdirectory :: FilePath -> FilePath -> Bool
- aDirectory :: FilePath -> IO Bool
- aSymbolicLink :: FilePath -> IO Bool
- anObject :: FilePath -> IO Bool
- putOrPageStrLn :: String -> IO ExitCode
Documentation
pairs :: [a] -> [(a, a)] Source #
Given a list [a]
, pairs
returns the list of all pairs
[(a,a)]
of [a]
progressing from the head to tail of [a]
. For
example,
pairs [x1,x2,x3,x4] == [(x1,x2),(x1,x3),(x1,x4),(x2,x3),(x2,x4),(x3,x4)]
Note that
pairs [] == [] pairs (x:[]) == []
unpairs :: Eq a => [(a, a)] -> [a] Source #
For length l /= 1
,
(unpairs . pairs) l == l
is True
.
Number of elements Number of pairs ------------------ --------------- 0 => 0 1 => 0 2 => 1 3 => 3 4 => 6 5 => 10 e => p = e(e-1)/2, e >= 0
reduceFilePath :: FilePath -> FilePath Source #
reduceFilePath
returns a pathname that is reduced to canonical
form equivalent to that of ksh(1), that is, symbolic link names are
treated literally when finding the directory name. See cd -L
of
ksh(1). Specifically, extraneous separators ("/")
, dot
(".")
, and double-dot ("..")
directories are removed.
absoluteLink :: FilePath -> FilePath -> FilePath -> FilePath Source #
Given a pathname wd
representing a workng directory and two
pathnames p1
and p2
, absoluteLink
returns the reduced
(reduceFilePath
) and absolute path to p2
to which p1
could point
as a symbolic link.
If wd
is not an absolute path, it is assumed to be a relative
path that is relative to the root directory of the file system tree
and is made an absolute path.
relativeLink :: FilePath -> FilePath -> FilePath -> FilePath Source #
Given a pathname wd
representing a workng directory and two
pathnames p1
and p2
, relativeLink
returns the reduced
(reduceFilePath
) and relative path from p1
to p2
to which
p1
could point as a symbolic link. Thus, p1
must not be the
root ("/")
, dot (".")
, nor double-dot ("..")
directories but of the form "/SomePath/SymLink"
If wd
is not an absolute path, it is assumed to be a relative
path that is relative to the root directory of the file system tree
and is made an absolute path.
subdirectories :: FilePath -> FilePath -> Bool Source #
subdirectories
returns true if either the absolute pathname
p1
or the absolute pathname p2
is a sub-directory or sub-path
of the other.
subdirectory :: FilePath -> FilePath -> Bool Source #
subdirectory
returns true if the absolute pathname p1
is a
subdirectory of the absolute pathname p2
as in
p1 `subdirectory` p2
otherwise false.
aDirectory :: FilePath -> IO Bool Source #
aDirectory
returns true if p
is not a symbolic link
and is a directory, otherwise false.
aSymbolicLink :: FilePath -> IO Bool Source #
aSymbolicLink
returns true if p
is a symbolic link, otherwise
false.