87 lines
38 KiB
HTML
87 lines
38 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>System.Path.NameManip</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
|
window.onload = function () {pageLoad();setSynopsis("mini_System-Path-NameManip.html");};
|
|
//]]>
|
|
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">MissingH-1.3.0.1: Large utility library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2004 Volker Wysk</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>John Goerzen <jgoerzen@complete.org></td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">System.Path.NameManip</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Low-level path name manipulations.</p><p>Written by Volker Wysk</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:slice_path">slice_path</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:unslice_path">unslice_path</a> :: [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:normalise_path">normalise_path</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:slice_filename">slice_filename</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:slice_filename-39-">slice_filename'</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:unslice_filename">unslice_filename</a> :: [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:split_path">split_path</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:dir_part">dir_part</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:filename_part">filename_part</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:unsplit_path">unsplit_path</a> :: (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:split_filename">split_filename</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:split_filename-39-">split_filename'</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:unsplit_filename">unsplit_filename</a> :: (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:split3">split3</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</li><li class="src short"><a href="#v:unsplit3">unsplit3</a> :: (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>) -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:test_suffix">test_suffix</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:absolute_path">absolute_path</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:absolute_path_by">absolute_path_by</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:absolute_path-39-">absolute_path'</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:guess_dotdot_comps">guess_dotdot_comps</a> :: [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>] -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:guess_dotdot">guess_dotdot</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:slice_path" class="def">slice_path</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path to be broken to components.</p></td></tr><tr><td class="src">-> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>List of path components.</p></td></tr></table></div><div class="doc"><p>Split a path in components. Repeated "<code>/</code>" characters don't lead to empty
|
|
components. "<code>.</code>" path components are removed. If the path is absolute, the first component
|
|
will start with "<code>/</code>". "<code>..</code>" components are left intact. They can't be simply
|
|
removed, because the preceding component might be a symlink. In this case,
|
|
<code>realpath</code> is probably what you need.</p><p>The case that the path is empty, is probably an error. However, it is
|
|
treated like "<code>.</code>", yielding an empty path components list.</p><p>Examples:</p><pre>slice_path "/" = ["/"]
|
|
slice_path "/foo/bar" = ["/foo","bar"]
|
|
slice_path "..//./" = [".."]
|
|
slice_path "." = []</pre><p>See <code><a href="System-Path-NameManip.html#v:unslice_path">unslice_path</a></code>, <code>realpath</code>, <code>realpath_s</code>.</p></div></div><div class="top"><p class="src"><a name="v:unslice_path" class="def">unslice_path</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>List of path components</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path which consists of the supplied path components</p></td></tr></table></div><div class="doc"><p>Form a path from path components. This isn't the inverse
|
|
of <code><a href="System-Path-NameManip.html#v:slice_path">slice_path</a></code>, since <code><code><a href="System-Path-NameManip.html#v:unslice_path">unslice_path</a></code> . <code><a href="System-Path-NameManip.html#v:slice_path">slice_path</a></code></code>
|
|
normalises the path.</p><p>See <code><a href="System-Path-NameManip.html#v:slice_path">slice_path</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:normalise_path" class="def">normalise_path</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path to be normalised</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path in normalised form</p></td></tr></table></div><div class="doc"><p>Normalise a path. This is done by reducing repeated <code>/</code> characters to one, and removing
|
|
<code>.</code> path components. <code>..</code> path components are left intact, because of possible symlinks.</p><pre><code><a href="System-Path-NameManip.html#v:normalise_path">normalise_path</a></code> = <code><a href="System-Path-NameManip.html#v:unslice_path">unslice_path</a></code> . <code><a href="System-Path-NameManip.html#v:slice_path">slice_path</a></code></pre></div></div><div class="top"><p class="src"><a name="v:slice_filename" class="def">slice_filename</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path</p></td></tr><tr><td class="src">-> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>List of components the file name is made up of</p></td></tr></table></div><div class="doc"><p>Split a file name in components. This are the base file name and the
|
|
suffixes, which are separated by dots. If the name starts with a dot, it is
|
|
regarded as part of the base name. The result is a list of file name
|
|
components. The filename may be a path. In this case, everything up to the
|
|
last path component will be returned as part of the base file name. The
|
|
path gets normalised thereby.</p><p>No empty suffixes are returned. If the file name contains several
|
|
consecutive dots, they are regared as part of the preceding file name
|
|
component.</p><p>Concateneting the name components and adding dots, reproduces the
|
|
original name, with a normalised path:
|
|
<code>concat . intersperse "." . <code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code> == <code>normalise</code></code>.</p><p>Note that the last path component might be "<code>..</code>". Then it is not
|
|
possible to deduce the refered directory's name from the path. An IO
|
|
action for getting the real path is then necessary.</p><p>Examples:</p><pre><code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code> "a.b//./.foo.tar.gz" == ["a.b/.foo","tar","gz"]
|
|
<code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code> ".x..y." == [".x.", "y."]
|
|
</pre><p>See <code><a href="System-Path-NameManip.html#v:unslice_filename">unslice_filename</a></code>, <code>slice_filename'</code>.</p></div></div><div class="top"><p class="src"><a name="v:slice_filename-39-" class="def">slice_filename'</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>File name without path</p></td></tr><tr><td class="src">-> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>List of components the file name is made up of</p></td></tr></table></div><div class="doc"><p>This is a variant of <code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code>. It is like <code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code>, except for
|
|
being more efficient, and the filename must not contain any preceding path,
|
|
since this case isn't considered.</p><p>See <code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code>, <code><a href="System-Path-NameManip.html#v:unslice_filename">unslice_filename</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:unslice_filename" class="def">unslice_filename</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>List of file name components</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Name of the file which consists of the supplied components</p></td></tr></table></div><div class="doc"><p>Form file name from file name components, interspersing dots. This is
|
|
the inverse of <code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code>, except for normalisation of any path.</p><pre>unslice_filename = concat . intersperse "."</pre><p>See <code><a href="System-Path-NameManip.html#v:slice_filename">slice_filename</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:split_path" class="def">split_path</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path to be split</p></td></tr><tr><td class="src">-> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>Directory and file name components of the path. The directory path is normalized.</p></td></tr></table></div><div class="doc"><p>Split a path in directory and file name. Only in the case that the
|
|
supplied path is empty, both parts are empty strings. Otherwise, <code>"."</code> is filled in
|
|
for the corresponding part, if necessary. Unless the path is empty,
|
|
concatenating the returned path and file name components with a slash in
|
|
between, makes a valid path to the file.</p><p><code>split_path</code> splits off the last path component. This
|
|
isn't the same as the text after the last <code>/</code>.</p><p>Note that the last path component might be <code>".."</code>. Then it is not
|
|
possible to deduce the refered directory's name from the path. Then an IO
|
|
action for getting the real path is necessary.</p><p>Examples:</p><pre>split_path "/a/b/c" == ("/a/b", "c")
|
|
split_path "foo" == (".", "foo")
|
|
split_path "foo/bar" == ("foo", "bar")
|
|
split_path "foo/.." == ("foo", "..")
|
|
split_path "." == (".", ".")
|
|
split_path "" == ("", "")
|
|
split_path "/foo" == ("/", "foo")
|
|
split_path "foo/" == (".", "foo")
|
|
split_path "foo/." == (".", "foo")
|
|
split_path "foo///./bar" == ("foo", "bar")</pre><p>See <code><a href="System-Path-NameManip.html#v:slice_path">slice_path</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:dir_part" class="def">dir_part</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Get the directory part of a path.</p><pre>dir_part = fst . split_path</pre><p>See <code><a href="System-Path-NameManip.html#v:split_path">split_path</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:filename_part" class="def">filename_part</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Get the last path component of a path.</p><pre>filename_part = snd . split_path</pre><p>Examples:</p><pre>filename_part "foo/bar" == "bar"
|
|
filename_part "." == "."</pre><p>See <code><a href="System-Path-NameManip.html#v:split_path">split_path</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:unsplit_path" class="def">unsplit_path</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>Directory and file name</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path formed from the directory and file name parts</p></td></tr></table></div><div class="doc"><p>Inverse of <code><a href="System-Path-NameManip.html#v:split_path">split_path</a></code>, except for normalisation.</p><p>This concatenates two paths, and takes care of <code>"."</code> and empty paths. When the two components are the result of <code>split_path</code>, then <code>unsplit_path</code>
|
|
creates a normalised path. It is best documented by its definition:</p><pre>unsplit_path (".", "") = "."
|
|
unsplit_path ("", ".") = "."
|
|
unsplit_path (".", q) = q
|
|
unsplit_path ("", q) = q
|
|
unsplit_path (p, "") = p
|
|
unsplit_path (p, ".") = p
|
|
unsplit_path (p, q) = p ++ "/" ++ q</pre><p>Examples:</p><pre>unsplit_path ("", "") == ""
|
|
unsplit_path (".", "") == "."
|
|
unsplit_path (".", ".") == "."
|
|
unsplit_path ("foo", ".") == "foo"</pre><p>See <code><a href="System-Path-NameManip.html#v:split_path">split_path</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:split_filename" class="def">split_filename</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path including the file name to be split</p></td></tr><tr><td class="src">-> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>The normalised path with the file prefix, and the file suffix.</p></td></tr></table></div><div class="doc"><p>Split a file name in prefix and suffix. If there isn't any suffix in
|
|
the file name, then return an empty suffix. A dot at the beginning or at
|
|
the end is not regarded as introducing a suffix.</p><p>The last path component is what is being split. This isn't the same as
|
|
splitting the string at the last dot. For instance, if the file name
|
|
doesn't contain any dot, dots in previous path component's aren't mistaken
|
|
as introducing suffixes.</p><p>The path part is returned in normalised form. This means, <code>"."</code> components
|
|
are removed, and multiple "<code>/</code>"s are reduced to one.</p><p>Note that there isn't any plausibility check performed on the suffix. If the file name doesn't have a suffix, but happens to contain a dot, then this
|
|
dot is mistaken as introducing a suffix.</p><p>Examples:</p><pre>split_filename "path/to/foo.bar" = ("path/to/foo","bar")
|
|
split_filename "path/to/foo" = ("path/to/foo","")
|
|
split_filename "/path.to/foo" = ("/path.to/foo","")
|
|
split_filename "a///./x" = ("a/x","")
|
|
split_filename "dir.suffix/./" = ("dir","suffix")
|
|
split_filename "Photographie, Das 20. Jahrhundert (300 dpi)" = ("Photographie, Das 20", " Jahrhundert (300 dpi)")</pre><p>See <code><a href="System-Path-NameManip.html#v:slice_path">slice_path</a></code>, 'split_filename\''</p></div></div><div class="top"><p class="src"><a name="v:split_filename-39-" class="def">split_filename'</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Filename to be split</p></td></tr><tr><td class="src">-> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>Base name and the last suffix</p></td></tr></table></div><div class="doc"><p>Variant of <code><a href="System-Path-NameManip.html#v:split_filename">split_filename</a></code>. This is a more efficient version
|
|
of <code><a href="System-Path-NameManip.html#v:split_filename">split_filename</a></code>, for the case that you know the string is
|
|
is a pure file name without any slashes.</p><p>See <code><a href="System-Path-NameManip.html#v:split_filename">split_filename</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:unsplit_filename" class="def">unsplit_filename</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>File name prefix and suffix</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path</p></td></tr></table></div><div class="doc"><p>Inverse of <code><a href="System-Path-NameManip.html#v:split_filename">split_filename</a></code>. Concatenate prefix and suffix, adding
|
|
a dot in between, iff the suffix is not empty. The path part of the prefix is
|
|
normalised.</p><p>See <code><a href="System-Path-NameManip.html#v:split_filename">split_filename</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:split3" class="def">split3</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path to split</p></td></tr><tr><td class="src">-> (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>Directory part, base file name part and suffix part</p></td></tr></table></div><div class="doc"><p>Split a path in directory, base file name and suffix.</p></div></div><div class="top"><p class="src"><a name="v:unsplit3" class="def">unsplit3</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>, <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>)</td><td class="doc"><p>Directory part, base file name part and suffix part</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path consisting of dir, base and suffix</p></td></tr></table></div><div class="doc"><p>Form path from directory, base file name and suffix parts.</p></div></div><div class="top"><p class="src"><a name="v:test_suffix" class="def">test_suffix</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Suffix to split off</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path to test</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Prefix without the suffix or <code>Nothing</code></p></td></tr></table></div><div class="doc"><p>Test a path for a specific suffix and split it off.</p><p>If the path ends with the suffix, then the result is <code>Just
|
|
prefix</code>, where <code>prefix</code> is the normalised path
|
|
without the suffix. Otherwise it's <code>Nothing</code>.</p></div></div><div class="top"><p class="src"><a name="v:absolute_path" class="def">absolute_path</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path to be made absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/System-IO.html#t:IO">IO</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Absulte path</p></td></tr></table></div><div class="doc"><p>Make a path absolute, using the current working directory.</p><p>This makes a relative path absolute with respect to the current
|
|
working directory. An absolute path is returned unmodified.</p><p>The current working directory is determined with <code>getCurrentDirectory</code>
|
|
which means that symbolic links in it are expanded and the path is
|
|
normalised. This is different from <code>pwd</code>.</p></div></div><div class="top"><p class="src"><a name="v:absolute_path_by" class="def">absolute_path_by</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The directory relative to which the path is made absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path to be made absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Absolute path</p></td></tr></table></div><div class="doc"><p>Make a path absolute.</p><p>This makes a relative path absolute with respect to a specified
|
|
directory. An absolute path is returned unmodified.</p></div></div><div class="top"><p class="src"><a name="v:absolute_path-39-" class="def">absolute_path'</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The path to be made absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>The directory relative to which the path is made absolute</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Absolute path</p></td></tr></table></div><div class="doc"><p>Make a path absolute.</p><p>This makes a relative path absolute with respect to a specified
|
|
directory. An absolute path is returned unmodified.</p><p>The order of the arguments can be confusing. You should rather use <code><a href="System-Path-NameManip.html#v:absolute_path_by">absolute_path_by</a></code>. <code>absolute_path'</code> is included for backwards compatibility.</p></div></div><div class="top"><p class="src"><a name="v:guess_dotdot_comps" class="def">guess_dotdot_comps</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>List of path components</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</td><td class="doc"><p>In case the path could be transformed, the <code>".."</code>-component free list of path components.</p></td></tr></table></div><div class="doc"><p>Guess the <code>".."</code>-component free form of a path, specified as a list of path components, by syntactically removing them, along with the preceding
|
|
path components. This will produce
|
|
erroneous results when the path contains symlinks. If the path contains leading <code>".."</code> components, or more <code>".."</code> components than preceeding normal
|
|
components, then the <code>".."</code> components can't be normalised away. In this case, the result is <code>Nothing</code>.</p></div></div><div class="top"><p class="src"><a name="v:guess_dotdot" class="def">guess_dotdot</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Path to be normalised</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></td><td class="doc"><p>In case the path could be transformed, the normalised, <code>".."</code>-component free form of the path.</p></td></tr></table></div><div class="doc"><p>Guess the <code>".."</code>-component free, normalised form of a path. The transformation is purely syntactic. <code>".."</code> path components will be removed, along
|
|
with their preceding path components. This will produce
|
|
erroneous results when the path contains symlinks. If the path contains leading <code>".."</code> components, or more <code>".."</code> components than preceeding normal
|
|
components, then the <code>".."</code> components can't be normalised away. In this case, the result is <code>Nothing</code>.</p><pre>guess_dotdot = fmap unslice_path . guess_dotdot_comps . slice_path</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html> |