Loading...

Streamly.FileSystem.Path.SegNode

Statically Verified Path Literals

Quasiquoters.

rtdir :: QuasiQuoter Source #

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

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

brdir :: QuasiQuoter Source #

Generates a Branch (Dir PosixPath) type from a quoted literal.

>>> Path.toString ([brdir|usr|] :: Branch (Dir PosixPath))
"usr"

rtfile :: QuasiQuoter Source #

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

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

brfile :: QuasiQuoter Source #

Generates a Branch (File PosixPath) type from a quoted literal.

>>> Path.toString ([brfile|x.txt|] :: Branch (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 PosixPath).

brdirE :: String -> Q Exp Source #

Generates a Haskell expression of type Branch (Dir PosixPath).

rtfileE :: String -> Q Exp Source #

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

brfileE :: String -> Q Exp Source #

Generates a Haskell expression of type Branch (File PosixPath).

Operations

append :: (IsPath PosixPath (a (Dir PosixPath)), IsPath PosixPath (b PosixPath), IsPath PosixPath (a (b PosixPath))) => a (Dir PosixPath) -> Branch (b PosixPath) -> a (b PosixPath) Source #

Append a branch type path to a directory.

>>> Path.toString (SegNode.append [rtdir|/usr|] [brdir|bin|] :: Rooted (Dir PosixPath))
"/usr/bin"
>>> Path.toString (SegNode.append [rtdir|/usr|] [brfile|bin|] :: Rooted (File PosixPath))
"/usr/bin"
>>> Path.toString (SegNode.append [brdir|usr|] [brdir|bin|] :: Branch (Dir PosixPath))
"usr/bin"
>>> Path.toString (SegNode.append [brdir|usr|] [brfile|bin|] :: Branch (File PosixPath))
"usr/bin"