HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulefoundation-0.0.30Haskell2010

Foundation.VFS.Path

Contents
  1. Path class
Synopsis

Path class

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