Safe Haskell | None |
---|---|
Language | Haskell2010 |
Path.Internal
Description
Internal types and functions.
Synopsis
- newtype Path b t = Path FilePath
- hasParentDir :: FilePath -> Bool
- relRootFP :: FilePath
- toFilePath :: Path b t -> FilePath
Documentation
Path of some base and type.
The type variables are:
b
— base, the base location of the path; absolute or relative.t
— type, whether file or directory.
Internally is a string. The string can be of two formats only:
- File format:
file.txt
,foo/bar.txt
,/foo/bar.txt
- Directory format:
foo/
,/foo/bar/
All directories end in a trailing separator. There are no duplicate
path separators //
, no ..
, no ./
, no ~/
, etc.
Constructors
Path FilePath |
Instances
Eq (Path b t) Source # | String equality. The following property holds: show x == show y ≡ x == y |
Ord (Path b t) Source # | String ordering. The following property holds: show x `compare` show y ≡ x `compare` y |
Show (Path b t) Source # | Same as 'show . Path.toFilePath'. The following property holds: x == y ≡ show x == show y |
NFData (Path b t) Source # | |
Defined in Path.Internal | |
FromJSON (Path Rel Dir) | |
FromJSON (Path Rel File) | |
FromJSON (Path Abs Dir) | |
FromJSON (Path Abs File) | |
ToJSON (Path b t) Source # | |
Defined in Path.Internal Methods toEncoding :: Path b t -> Encoding toJSONList :: [Path b t] -> Value toEncodingList :: [Path b t] -> Encoding | |
Hashable (Path b t) Source # | |
Defined in Path.Internal |
hasParentDir :: FilePath -> Bool Source #
Helper function: check if the filepath has any parent directories in it. This handles the logic of checking for different path separators on Windows.
toFilePath :: Path b t -> FilePath Source #
Convert to a FilePath
type.
All directories have a trailing slash, so if you want no trailing
slash, you can use dropTrailingPathSeparator
from
the filepath package.