path-0.6.1: Support for well-typed paths

Path.Internal

Description

Internal types and functions.

Synopsis

# Documentation

newtype Path b t Source #

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:

1. File format: file.txt, foo/bar.txt, /foo/bar.txt
2. 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 Methods(==) :: Path b t -> Path b t -> Bool #(/=) :: Path b t -> Path b t -> Bool # Ord (Path b t) Source # String ordering.The following property holds:show x compare show y ≡ x compare y Methodscompare :: Path b t -> Path b t -> Ordering #(<) :: Path b t -> Path b t -> Bool #(<=) :: Path b t -> Path b t -> Bool #(>) :: Path b t -> Path b t -> Bool #(>=) :: Path b t -> Path b t -> Bool #max :: Path b t -> Path b t -> Path b t #min :: Path b t -> Path b t -> Path b t # Show (Path b t) Source # Same as 'show . Path.toFilePath'.The following property holds:x == y ≡ show x == show y MethodsshowsPrec :: Int -> Path b t -> ShowS #show :: Path b t -> String #showList :: [Path b t] -> ShowS # Hashable (Path b t) Source # MethodshashWithSalt :: Int -> Path b t -> Int #hash :: Path b t -> Int # ToJSON (Path b t) Source # MethodstoJSON :: Path b t -> Value #toEncoding :: Path b t -> Encoding #toJSONList :: [Path b t] -> Value #toEncodingList :: [Path b t] -> Encoding # # Methods # Methods # Methods # Methods NFData (Path b t) Source # Methodsrnf :: Path b t -> () #

Helper function: check if the filepath has any parent directories in it. This handles the logic of checking for different path separators on Windows.

Normalized file path representation for the relative path root

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.