| Copyright | (c) 2023 Composewell Technologies |
|---|---|
| License | BSD3 |
| Maintainer | streamly@composewell.com |
| Portability | GHC |
| Safe Haskell | None |
| Language | Haskell2010 |
Streamly.Internal.FileSystem.PosixPath.Node
Description
This module provides a type safe path append operation by distinguishing
paths between files and directories. Files are represented by the File
PosixPath type and directories are represented by the Dir PosixPath type.
This distinction provides safety against appending a path to a file. Append
operation allows appending to only Dir types.
Types
Constructors
| File a |
Constructors
| Dir a |
Instances
| IsNode (Dir a) Source # | |
Defined in Streamly.Internal.FileSystem.PosixPath.Node | |
| IsNode (File a) Source # | |
Defined in Streamly.Internal.FileSystem.PosixPath.Node | |
Statically Verified Path Literals
Quasiquoters.
dir :: QuasiQuoter Source #
Generates a Dir PosixPath type from a quoted literal.
>>>Path.toString (Path.toPath ([dir|usr|] :: Dir PosixPath))"usr"
file :: QuasiQuoter Source #
Generates a File PosixPath type from a quoted literal.
>>>Path.toString (Path.toPath ([file|usr|] :: File PosixPath))"usr"
Statically Verified Path Strings
Template Haskell expression splices.
Operations
join :: (IsPath PosixPath (a PosixPath), IsNode (a PosixPath)) => Dir PosixPath -> a PosixPath -> a PosixPath Source #
Append a Dir or File path to a Dir path.
>>>Path.toString (Path.toPath (Node.join [dir|/usr|] [dir|bin|] :: Dir PosixPath))"/usr/bin">>>Path.toString (Path.toPath (Node.join [dir|/usr|] [file|bin|] :: File PosixPath))"/usr/bin"
Fails if the second path is a specific location and not a path segment.