HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulefoundation-0.0.30Haskell2010

Foundation.VFS

  • 2 types
  • 1 class
  • 6 values
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
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
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
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

FilePath

2 declarations
datadata FilePath
#

FilePath is a collection of FileName

TODO: Eq and Ord are implemented using Show This is not very efficient and would need to be improved Also, it is possible the ordering is not necessary what we want in this case.

A FilePath is one of the following:

  • An Absolute:

  • starts with one of the follwing "/"

  • A relative:

  • don't start with a "/"

  • authorised:

  • "/"

  • "filepath"

  • "."

  • ".."

  • "workhaskellhs-foundation"

  • unauthorised

  • "path//"

Instances8Eq, Ord, Show, IsString, Path, PathEnt, …
datadata FileName
#

A filename (or path entity) in the FilePath

  • Authorised

  • ""

  • "."

  • ".."

  • "foundation"

  • Unauthorised

  • "/"

  • "file/"

  • "/file"

  • "file/path"

Instances5Eq, Show, IsString, Semigroup, Monoid
  • Eq FileNameDefined in foundation-0.0.30 · Foundation.VFS.FilePath
  • Show FileNameDefined in foundation-0.0.30 · Foundation.VFS.FilePath
  • IsString FileNameDefined in foundation-0.0.30 · Foundation.VFS.FilePath
  • Semigroup FileNameDefined in foundation-0.0.30 · Foundation.VFS.FilePath
  • Monoid FileNameDefined in foundation-0.0.30 · Foundation.VFS.FilePath

conversion