HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefoundation-0.0.30Haskell2010

Foundation.VFS.Path

  • 1 class
  • 4 values

Path class

5 declarations
classclass Path path where
#

Path type class

defines the Path associated types and basic functions to implement related to the path manipulation

# TODO, add missing enhancement:

splitExtension :: PathEnt path -> (PathEnt path, PathEnt path)
addExtension  :: PathEnt path -> PathEnt path -> PathEnt path
(.) :: path -> PathEnt path -> path
(-.) :: path -> PathEnt path -> path

Associated types

  • type family PathEnt path

    the associated PathEntity of the given path this type is the minimal element contained in the Path a Path is not a collection but it is possible to see this associated type equivalent to the Element type family

  • type family PathPrefix path

    the associated prefix of the given path

    in the case of a Foundation.VFS.FilePath, it is a void (i.e. ()) in the case of a Foundation.VFS.URI, it is the schema, host, port...

  • type family PathSuffix path

    the associated suffix of the given path

    in the case of the Foundation.VFS.FilePath, it is a void (i.e. ()) in the case of the Foundation.VFS.URI, it is a the query, the fragment

Methods

Instances2Path
  • Path FilePathDefined in foundation-0.0.30 · Foundation.VFS.FilePath
  • Path URIDefined in foundation-0.0.30 · Foundation.VFS.URI
valueparent :: Path path => path -> path
#

parent is only going to drop the filename.

if you actually want to reference to the parent directory, simply uses:

parent "." = "." <> ".."
Example1 expression
parent ("foo.hs" :: FilePath).
Example1 expression
parent ("foo/bar/baz.hs" :: FilePath)foo/bar
valuefilename :: (Path path, Monoid (PathEnt path)) => path -> PathEnt path
#

get the filename of the given path

If there is no filename, you will receive the mempty of the PathEnt

Example1 expression
filename ("foo.hs" :: FilePath)foo.hs
Example1 expression
filename ("foo/bar/baz.hs" :: FilePath)baz.hs
valueprefix :: Path path => path -> PathPrefix path
#

get the path prefix information

Example1 expression
prefix ("/home/tab" :: FilePath)Absolute
Example1 expression
prefix ("home/tab" :: FilePath)Relative

or for URI (TODO, not yet accurate)

prefix "http://github.com/vincenthz/hs-foundation?w=1"
   == URISchema http Nothing Nothing "github.com" Nothing