streamly-core
Copyright(c) 2023 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Streamly.Internal.FileSystem.WindowsPath.SegNode

Description

When Rooted/Unrooted and File/Dir both are present, Rooted/Unrooted must be outermost constructors and File/Dir as inner. Thus the types File (Rooted a) or Dir (Rooted a) are not allowed but Rooted (Dir a) and Rooted (File a) are allowed.

Synopsis

Statically Verified Path Literals

Quasiquoters.

rtdir :: QuasiQuoter Source #

Generates a Rooted (Dir WindowsPath) type from a quoted literal.

>>> Path.toString (Path.toPath ([rtdir|/usr|] :: Rooted (Dir PosixPath)))
"/usr"

urdir :: QuasiQuoter Source #

Generates a Unrooted (Dir WindowsPath) type from a quoted literal.

>>> Path.toString (Path.toPath ([urdir|usr|] :: Unrooted (Dir PosixPath)))
"usr"

rtfile :: QuasiQuoter Source #

Generates a Rooted (File WindowsPath) type from a quoted literal.

>>> Path.toString (Path.toPath ([rtfile|/x.txt|] :: Rooted (File PosixPath)))
"/x.txt"

urfile :: QuasiQuoter Source #

Generates a Unrooted (File WindowsPath) type from a quoted literal.

>>> Path.toString (Path.toPath ([urfile|x.txt|] :: Unrooted (File PosixPath)))
"x.txt"

Statically Verified Path Strings

Template Haskell expression splices.

rtdirE :: String -> Q Exp Source #

Generates a Haskell expression of type Rooted (Dir WindowsPath).

urdirE :: String -> Q Exp Source #

Generates a Haskell expression of type Unrooted (Dir WindowsPath).

rtfileE :: String -> Q Exp Source #

Generates a Haskell expression of type Rooted (File WindowsPath).

urfileE :: String -> Q Exp Source #

Generates a Haskell expression of type Unrooted (File WindowsPath).

Operations

join :: (IsPath WindowsPath (a (Dir WindowsPath)), IsPath WindowsPath (b WindowsPath), IsPath WindowsPath (a (b WindowsPath))) => a (Dir WindowsPath) -> Unrooted (b WindowsPath) -> a (b WindowsPath) Source #

Append a branch type path to a directory.

>>> Path.toString (Path.toPath (SegNode.join [rtdir|/usr|] [urdir|bin|] :: Rooted (Dir PosixPath)))
"/usr/bin"
>>> Path.toString (Path.toPath (SegNode.join [rtdir|/usr|] [urfile|bin|] :: Rooted (File PosixPath)))
"/usr/bin"
>>> Path.toString (Path.toPath (SegNode.join [urdir|usr|] [urdir|bin|] :: Unrooted (Dir PosixPath)))
"usr/bin"
>>> Path.toString (Path.toPath (SegNode.join [urdir|usr|] [urfile|bin|] :: Unrooted (File PosixPath)))
"usr/bin"

Orphan instances