Hoogle Search
Within LTS Haskell 24.25 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
replaceProperPrefix :: MonadThrow m => Path b Dir -> Path b' Dir -> Path b t -> m (Path b' t)path OsPath.Posix Change from one directory prefix to another. Throw NotAProperPrefix if the first argument is not a proper prefix of the path.
>>> replaceProperPrefix $(mkRelDir "foo") $(mkRelDir "bar") $(mkRelFile "foo/file.txt") == $(mkRelFile "bar/file.txt")
stripProperPrefix :: MonadThrow m => Path b Dir -> Path b t -> m (Path Rel t)path OsPath.Posix If the directory in the first argument is a proper prefix of the path in the second argument strip it from the second argument, generating a path relative to the directory. Throws NotAProperPrefix if the directory is not a proper prefix of the path. The following properties hold:
stripProperPrefix x (x </> y) = y
Cases which are proven not possible:stripProperPrefix (a :: Path Abs …) (b :: Path Rel …)
stripProperPrefix (a :: Path Rel …) (b :: Path Abs …)
In other words the bases must match.NotAProperPrefix :: WindowsPath -> WindowsPath -> PathExceptionpath OsPath.Windows No documentation available.
isProperPrefixOf :: Path b Dir -> Path b t -> Boolpath OsPath.Windows Determines if the path in the first parameter is a proper prefix of the path in the second parameter. The following properties hold:
not (x `isProperPrefixOf` x)
x `isProperPrefixOf` (x </> y)
replaceProperPrefix :: MonadThrow m => Path b Dir -> Path b' Dir -> Path b t -> m (Path b' t)path OsPath.Windows Change from one directory prefix to another. Throw NotAProperPrefix if the first argument is not a proper prefix of the path.
>>> replaceProperPrefix $(mkRelDir "foo") $(mkRelDir "bar") $(mkRelFile "foo/file.txt") == $(mkRelFile "bar/file.txt")
stripProperPrefix :: MonadThrow m => Path b Dir -> Path b t -> m (Path Rel t)path OsPath.Windows If the directory in the first argument is a proper prefix of the path in the second argument strip it from the second argument, generating a path relative to the directory. Throws NotAProperPrefix if the directory is not a proper prefix of the path. The following properties hold:
stripProperPrefix x (x </> y) = y
Cases which are proven not possible:stripProperPrefix (a :: Path Abs …) (b :: Path Rel …)
stripProperPrefix (a :: Path Rel …) (b :: Path Abs …)
In other words the bases must match.-
Internal types and functions.
-
This library provides a well-typed representation of paths in a filesystem directory tree. Note: This module is for working with Posix style paths. Importing Path is usually better. A path is represented by a number of path components separated by a path separator which is a / on POSIX systems and can be a / or \ on Windows. The root of the tree is represented by a / on POSIX and a drive letter followed by a / or \ on Windows (e.g. C:\). Paths can be absolute or relative. An absolute path always starts from the root of the tree (e.g. /x/y) whereas a relative path never starts with the root (e.g. x/y). Just like we represent the notion of an absolute root by "/", the same way we represent the notion of a relative root by ".". The relative root denotes the directory which contains the first component of a relative path.
NotAProperPrefix :: FilePath -> FilePath -> PathExceptionpath Path.Posix No documentation available.
isProperPrefixOf :: Path b Dir -> Path b t -> Boolpath Path.Posix Determines if the path in the first parameter is a proper prefix of the path in the second parameter. The following properties hold:
not (x `isProperPrefixOf` x)
x `isProperPrefixOf` (x </> y)