path-0.8.0: Support for well-typed paths
Safe HaskellNone
LanguageHaskell2010

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

Instances details
(Typeable a, Typeable b) => Lift (Path a b :: Type) Source # 
Instance details

Defined in Path.Internal

Methods

lift :: Path a b -> Q Exp

liftTyped :: Path a b -> Q (TExp (Path a b))

Eq (Path b t) Source #

String equality.

The following property holds:

show x == show y ≡ x == y
Instance details

Defined in Path.Internal

Methods

(==) :: Path b t -> Path b t -> Bool

(/=) :: Path b t -> Path b t -> Bool

(Data b, Data t) => Data (Path b t) Source # 
Instance details

Defined in Path.Internal

Methods

gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Path b t -> c (Path b t)

gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Path b t)

toConstr :: Path b t -> Constr

dataTypeOf :: Path b t -> DataType

dataCast1 :: Typeable t0 => (forall d. Data d => c (t0 d)) -> Maybe (c (Path b t))

dataCast2 :: Typeable t0 => (forall d e. (Data d, Data e) => c (t0 d e)) -> Maybe (c (Path b t))

gmapT :: (forall b0. Data b0 => b0 -> b0) -> Path b t -> Path b t

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Path b t -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Path b t -> r

gmapQ :: (forall d. Data d => d -> u) -> Path b t -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> Path b t -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Path b t -> m (Path b t)

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Path b t -> m (Path b t)

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Path b t -> m (Path b t)

Ord (Path b t) Source #

String ordering.

The following property holds:

show x `compare` show y ≡ x `compare` y
Instance details

Defined in Path.Internal

Methods

compare :: 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
Instance details

Defined in Path.Internal

Methods

showsPrec :: Int -> Path b t -> ShowS

show :: Path b t -> String

showList :: [Path b t] -> ShowS

Generic (Path b t) Source # 
Instance details

Defined in Path.Internal

Associated Types

type Rep (Path b t) :: Type -> Type

Methods

from :: Path b t -> Rep (Path b t) x

to :: Rep (Path b t) x -> Path b t

NFData (Path b t) Source # 
Instance details

Defined in Path.Internal

Methods

rnf :: Path b t -> ()

FromJSON (Path Rel Dir) 
Instance details

Defined in Path.Posix

Methods

parseJSON :: Value -> Parser (Path Rel Dir)

parseJSONList :: Value -> Parser [Path Rel Dir]

FromJSON (Path Rel File) 
Instance details

Defined in Path.Posix

Methods

parseJSON :: Value -> Parser (Path Rel File)

parseJSONList :: Value -> Parser [Path Rel File]

FromJSON (Path Abs Dir) 
Instance details

Defined in Path.Posix

Methods

parseJSON :: Value -> Parser (Path Abs Dir)

parseJSONList :: Value -> Parser [Path Abs Dir]

FromJSON (Path Abs File) 
Instance details

Defined in Path.Posix

Methods

parseJSON :: Value -> Parser (Path Abs File)

parseJSONList :: Value -> Parser [Path Abs File]

FromJSON (Path Rel Dir) 
Instance details

Defined in Path.Windows

Methods

parseJSON :: Value -> Parser (Path Rel Dir)

parseJSONList :: Value -> Parser [Path Rel Dir]

FromJSON (Path Rel File) 
Instance details

Defined in Path.Windows

Methods

parseJSON :: Value -> Parser (Path Rel File)

parseJSONList :: Value -> Parser [Path Rel File]

FromJSON (Path Abs Dir) 
Instance details

Defined in Path.Windows

Methods

parseJSON :: Value -> Parser (Path Abs Dir)

parseJSONList :: Value -> Parser [Path Abs Dir]

FromJSON (Path Abs File) 
Instance details

Defined in Path.Windows

Methods

parseJSON :: Value -> Parser (Path Abs File)

parseJSONList :: Value -> Parser [Path Abs File]

FromJSONKey (Path Rel Dir) 
Instance details

Defined in Path.Posix

Methods

fromJSONKey :: FromJSONKeyFunction (Path Rel Dir)

fromJSONKeyList :: FromJSONKeyFunction [Path Rel Dir]

FromJSONKey (Path Rel File) 
Instance details

Defined in Path.Posix

Methods

fromJSONKey :: FromJSONKeyFunction (Path Rel File)

fromJSONKeyList :: FromJSONKeyFunction [Path Rel File]

FromJSONKey (Path Abs Dir) 
Instance details

Defined in Path.Posix

Methods

fromJSONKey :: FromJSONKeyFunction (Path Abs Dir)

fromJSONKeyList :: FromJSONKeyFunction [Path Abs Dir]

FromJSONKey (Path Abs File) 
Instance details

Defined in Path.Posix

Methods

fromJSONKey :: FromJSONKeyFunction (Path Abs File)

fromJSONKeyList :: FromJSONKeyFunction [Path Abs File]

FromJSONKey (Path Rel Dir) 
Instance details

Defined in Path.Windows

Methods

fromJSONKey :: FromJSONKeyFunction (Path Rel Dir)

fromJSONKeyList :: FromJSONKeyFunction [Path Rel Dir]

FromJSONKey (Path Rel File) 
Instance details

Defined in Path.Windows

Methods

fromJSONKey :: FromJSONKeyFunction (Path Rel File)

fromJSONKeyList :: FromJSONKeyFunction [Path Rel File]

FromJSONKey (Path Abs Dir) 
Instance details

Defined in Path.Windows

Methods

fromJSONKey :: FromJSONKeyFunction (Path Abs Dir)

fromJSONKeyList :: FromJSONKeyFunction [Path Abs Dir]

FromJSONKey (Path Abs File) 
Instance details

Defined in Path.Windows

Methods

fromJSONKey :: FromJSONKeyFunction (Path Abs File)

fromJSONKeyList :: FromJSONKeyFunction [Path Abs File]

ToJSON (Path b t) Source # 
Instance details

Defined in Path.Internal

Methods

toJSON :: Path b t -> Value

toEncoding :: Path b t -> Encoding

toJSONList :: [Path b t] -> Value

toEncodingList :: [Path b t] -> Encoding

ToJSONKey (Path b t) Source # 
Instance details

Defined in Path.Internal

Methods

toJSONKey :: ToJSONKeyFunction (Path b t)

toJSONKeyList :: ToJSONKeyFunction [Path b t]

Hashable (Path b t) Source # 
Instance details

Defined in Path.Internal

Methods

hashWithSalt :: Int -> Path b t -> Int

hash :: Path b t -> Int

type Rep (Path b t) Source # 
Instance details

Defined in Path.Internal

type Rep (Path b t) = D1 ('MetaData "Path" "Path.Internal" "path-0.8.0-2eYvXA9K3VmBdhaapABtgm" 'True) (C1 ('MetaCons "Path" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)))

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.

relRootFP :: FilePath Source #

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.