HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulestreamly-core-0.3.1Haskell2010

Streamly.Internal.FileSystem.PosixPath.Node

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.

  • 2 types
  • 1 class
  • 5 values

Types

3 declarations
newtypenewtype File a
#

Constructors

Instances4IsPath, IsNode
newtypenewtype Dir a
#

Constructors

Instances4IsPath, IsNode
classclass IsNode a
#

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

Instances2IsNode
  • IsNode (Dir a)Defined in streamly-core-0.3.1 · Streamly.Internal.FileSystem.PosixPath.Node
  • IsNode (File a)Defined in streamly-core-0.3.1 · Streamly.Internal.FileSystem.PosixPath.Node

Statically Verified Path Literals

2 declarations

Quasiquoters.

valuedir :: QuasiQuoter
#

Generates a Dir PosixPath type from a quoted literal.

Example1 expression
Path.toString (Path.toPath ([dir|usr|] :: Dir PosixPath))"usr"
valuefile :: QuasiQuoter
#

Generates a File PosixPath type from a quoted literal.

Example1 expression
Path.toString (Path.toPath ([file|usr|] :: File PosixPath))"usr"

Statically Verified Path Strings

2 declarations

Template Haskell expression splices.

valuedirE :: String -> Q Exp
#

Generates a Haskell expression of type Dir PosixPath.

valuefileE :: String -> Q Exp
#

Generates a Haskell expression of type File PosixPath.

Operations

1 declaration

Append a Dir or File path to a Dir path.

Example2 expressions
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.