Loading...

Streamly.Internal.FileSystem.WindowsPath.Node

This module provides a type safe path append operation by distinguishing paths between files and directories. Files are represented by the File WindowsPath type and directories are represented by the Dir WindowsPath type.

This distinction provides safety against appending a path to a file. Append operation allows appending to only Dir types.

Types

class IsNode a Source #

Constraint to check if a type uses File or Dir as the outermost constructor.

Instances
Instances details
IsNode (Dir a) Source # 
Instance details

Defined in Streamly.Internal.FileSystem.WindowsPath.Node

IsNode (File a) Source # 
Instance details

Defined in Streamly.Internal.FileSystem.WindowsPath.Node

Statically Verified Path Literals

Quasiquoters.

dir :: QuasiQuoter Source #

Generates a Dir WindowsPath type from a quoted literal.

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

file :: QuasiQuoter Source #

Generates a File WindowsPath type from a quoted literal.

>>> Path.toString ([file|usr|] :: File PosixPath)
"usr"

Statically Verified Path Strings

Template Haskell expression splices.

dirE :: String -> Q Exp Source #

Generates a Haskell expression of type Dir WindowsPath.

fileE :: String -> Q Exp Source #

Generates a Haskell expression of type File WindowsPath.

Operations

append :: (IsPath WindowsPath (a WindowsPath), IsNode (a WindowsPath)) => Dir WindowsPath -> a WindowsPath -> a WindowsPath Source #

Append a Dir or File path to a Dir path.

>>> Path.toString (Node.append [dir|/usr|] [dir|bin|] :: Dir PosixPath)
"/usr/bin"
>>> Path.toString (Node.append [dir|/usr|] [file|bin|] :: File PosixPath)
"/usr/bin"

Fails if the second path is a specific location and not a path segment.