Copyright | (c) 2023 Composewell Technologies |
---|---|
License | BSD3 |
Maintainer | streamly@composewell.com |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Streamly.Internal.FileSystem.PosixPath.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
- rtdir :: QuasiQuoter
- urdir :: QuasiQuoter
- rtfile :: QuasiQuoter
- urfile :: QuasiQuoter
- rtdirE :: String -> Q Exp
- urdirE :: String -> Q Exp
- rtfileE :: String -> Q Exp
- urfileE :: String -> Q Exp
- join :: (IsPath PosixPath (a (Dir PosixPath)), IsPath PosixPath (b PosixPath), IsPath PosixPath (a (b PosixPath))) => a (Dir PosixPath) -> Unrooted (b PosixPath) -> a (b PosixPath)
Statically Verified Path Literals
Quasiquoters.
rtdir :: QuasiQuoter Source #
Generates a Rooted (Dir PosixPath)
type from a quoted literal.
>>>
Path.toString (Path.toPath ([rtdir|/usr|] :: Rooted (Dir PosixPath)))
"/usr"
urdir :: QuasiQuoter Source #
Generates a Unrooted (Dir PosixPath)
type from a quoted literal.
>>>
Path.toString (Path.toPath ([urdir|usr|] :: Unrooted (Dir PosixPath)))
"usr"
rtfile :: QuasiQuoter Source #
Generates a Rooted (File PosixPath)
type from a quoted literal.
>>>
Path.toString (Path.toPath ([rtfile|/x.txt|] :: Rooted (File PosixPath)))
"/x.txt"
urfile :: QuasiQuoter Source #
Generates a Unrooted (File PosixPath)
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.
urfileE :: String -> Q Exp Source #
Generates a Haskell expression of type Unrooted (File PosixPath)
.
Operations
join :: (IsPath PosixPath (a (Dir PosixPath)), IsPath PosixPath (b PosixPath), IsPath PosixPath (a (b PosixPath))) => a (Dir PosixPath) -> Unrooted (b PosixPath) -> a (b PosixPath) 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"