105 lines
36 KiB
HTML
105 lines
36 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>HPath</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||
|
window.onload = function () {pageLoad();setSynopsis("mini_HPath.html");};
|
||
|
//]]>
|
||
|
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/HPath.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hpath-0.7.3: Support for well-typed paths</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>© 2015–2016 FP Complete, 2016 Julian Ospald</td></tr><tr><th>License</th><td>BSD 3 clause</td></tr><tr><th>Maintainer</th><td>Julian Ospald <hasufell@posteo.de></td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">HPath</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Types</a></li><li><a href="#g:2">PatternSynonyms/ViewPatterns</a></li><li><a href="#g:3">Path Parsing</a></li><li><a href="#g:4">Path Conversion</a></li><li><a href="#g:5">Path Operations</a></li><li><a href="#g:6">Path IO helpers</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Support for well-typed paths.</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"><span class="keyword">data</span> <a href="#t:Abs">Abs</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Path">Path</a> b</li><li class="src short"><span class="keyword">data</span> <a href="#t:Rel">Rel</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:Fn">Fn</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:PathParseException">PathParseException</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:PathException">PathException</a></li><li class="src short"><span class="keyword">class</span> <a href="#t:RelC">RelC</a> m</li><li class="src short"><span class="keyword">pattern</span> <a href="#v:Path">Path</a> :: <span class="keyword">forall</span> a. <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> <a href="HPath.html#t:Path">Path</a> a</li><li class="src short"><a href="#v:parseAbs">parseAbs</a> :: MonadThrow m => <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a>)</li><li class="src short"><a href="#v:parseFn">parseFn</a> :: MonadThrow m => <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Fn">Fn</a>)</li><li class="src short"><a href="#v:parseRel">parseRel</a> :: MonadThrow m => <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Rel">Rel</a>)</li><li class="src short"><a href="#v:fromAbs">fromAbs</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a> -> <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:fromRel">fromRel</a> :: <a href="HPath.html#t:RelC">RelC</a> r => <a href="HPath.html#t:Path">Path</a> r -> <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:toFilePath">toFilePath</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:-60--47--62-">(</>)</a> :: <a href="HPath.html#t:RelC">RelC<
|
||
|
path separators <code>//</code>, no <code>..</code>, no <code>./</code>, no <code>~/</code>, etc.</p></div><div class="subs instances"><p id="control.i:Path" class="caption collapser" onclick="toggleSection('i:Path')">Instances</p><div id="section.i:Path" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Path:Eq:1" class="instance expander" onclick="toggleSection('i:id:Path:Eq:1')"></span> Eq (<a href="HPath.html#t:Path">Path</a> b)</span> <a href="src/HPath-Internal.html#line-30" class="link">Source</a> <a href="#t:Path" class="selflink">#</a></td><td class="doc"><p>ByteString equality.</p><p>The following property holds:</p><pre>show x == show y ≡ x == y</pre></td></tr><tr><td colspan="2"><div id="section.i:id:Path:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool</p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool</p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Path:Ord:2" class="instance expander" onclick="toggleSection('i:id:Path:Ord:2')"></span> Ord (<a href="HPath.html#t:Path">Path</a> b)</span> <a href="src/HPath-Internal.html#line-38" class="link">Source</a> <a href="#t:Path" class="selflink">#</a></td><td class="doc"><p>ByteString ordering.</p><p>The following property holds:</p><pre>show x `compare` show y ≡ x `compare` y</pre></td></tr><tr><td colspan="2"><div id="section.i:id:Path:Ord:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Ordering</p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool</p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool</p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool</p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool</p><p class="src"><a href="#v:max">max</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b</p><p class="src"><a href="#v:min">min</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b</p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Path:Show:3" class="instance expander" onclick="toggleSection('i:id:Path:Show:3')"></span> Show (<a href="HPath.html#t:Path">Path</a> b)</span> <a href="src/HPath-Internal.html#line-46" class="link">Source</a> <a href="#t:Path" class="selflink">#</a></td><td class="doc"><p>Same as <code><a href="HPath.html#v:toFilePath">toFilePath</a></code>.</p><p>The following property holds:</p><pre>x == y ≡ show x == show y</pre></td></tr><tr><td colspan="2"><div id="section.i:id:Path:Show:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: Int -> <a href="HPath.html#t:Path">Path</a> b -> ShowS</p><p class="src"><a href="#v:show">show</a> :: <a href="HPath.html#t:Path">Path</a> b -> String</p><p class="src"><a href="#v:showList">showList</a> :: [<a href="HPath.html#t:Path">Path</a> b] -> ShowS</p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Path:NFData:4" class="instance expander" onclick="toggleSection('i:id:Path:NFData:4')"></span> NFData (<a href="
|
||
|
</code></strong>Just "/abc"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseAbs "/" :: Maybe (Path Abs)
|
||
|
</code></strong>Just "/"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseAbs "/abc/def" :: Maybe (Path Abs)
|
||
|
</code></strong>Just "/abc/def"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseAbs "/abc/def/.///" :: Maybe (Path Abs)
|
||
|
</code></strong>Just "/abc/def/"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseAbs "abc" :: Maybe (Path Abs)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseAbs "" :: Maybe (Path Abs)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseAbs "/abc/../foo" :: Maybe (Path Abs)
|
||
|
</code></strong>Nothing
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:parseFn" class="def">parseFn</a> :: MonadThrow m => <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Fn">Fn</a>) <a href="src/HPath.html#parseFn" class="link">Source</a> <a href="#v:parseFn" class="selflink">#</a></p><div class="doc"><p>Parses a filename. Filenames must not contain slashes.
|
||
|
Excludes <code>.</code> and '..'.</p><p>Throws: <code><a href="HPath.html#t:PathParseException">PathParseException</a></code></p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>parseFn "abc" :: Maybe (Path Fn)
|
||
|
</code></strong>Just "abc"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "..." :: Maybe (Path Fn)
|
||
|
</code></strong>Just "..."
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "def/" :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "abc/def" :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "abc/def/." :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "/abc" :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "" :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "abc/../foo" :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn "." :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseFn ".." :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:parseRel" class="def">parseRel</a> :: MonadThrow m => <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Rel">Rel</a>) <a href="src/HPath.html#parseRel" class="link">Source</a> <a href="#v:parseRel" class="selflink">#</a></p><div class="doc"><p>Get a location for a relative path. Produces a normalised
|
||
|
path.</p><p>Note that <code>filepath</code> may contain any number of <code>./</code> but may not consist
|
||
|
solely of <code>./</code>. It also may not contain a single <code>..</code> anywhere.</p><p>Throws: <code><a href="HPath.html#t:PathParseException">PathParseException</a></code></p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>parseRel "abc" :: Maybe (Path Rel)
|
||
|
</code></strong>Just "abc"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "def/" :: Maybe (Path Rel)
|
||
|
</code></strong>Just "def/"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "abc/def" :: Maybe (Path Rel)
|
||
|
</code></strong>Just "abc/def"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "abc/def/." :: Maybe (Path Rel)
|
||
|
</code></strong>Just "abc/def/"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "/abc" :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "" :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "abc/../foo" :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel "." :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>parseRel ".." :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
</pre></div></div><h1 id="g:4">Path Conversion</h1><div class="top"><p class="src"><a id="v:fromAbs" class="def">fromAbs</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a> -> <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> <a href="src/HPath.html#fromAbs" class="link">Source</a> <a href="#v:fromAbs" class="selflink">#</a></p><div class="doc"><p>Convert an absolute Path to a ByteString type.</p></div></div><div class="top"><p class="src"><a id="v:fromRel" class="def">fromRel</a> :: <a href="HPath.html#t:RelC">RelC</a> r => <a href="HPath.html#t:Path">Path</a> r -> <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> <a href="src/HPath.html#fromRel" class="link">Source</a> <a href="#v:fromRel" class="selflink">#</a></p><div class="doc"><p>Convert a relative Path to a ByteString type.</p></div></div><div class="top"><p class="src"><a id="v:toFilePath" class="def">toFilePath</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> <a href="src/HPath.html#toFilePath" class="link">Source</a> <a href="#v:toFilePath" class="selflink">#</a></p><div class="doc"><p>Convert any Path to a ByteString type.</p></div></div><h1 id="g:5">Path Operations</h1><div class="top"><p class="src"><a id="v:-60--47--62-" class="def">(</>)</a> :: <a href="HPath.html#t:RelC">RelC</a> r => <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> r -> <a href="HPath.html#t:Path">Path</a> b <a href="src/HPath.html#%3C%2F%3E" class="link">Source</a> <a href="#v:-60--47--62-" class="selflink">#</a></p><div class="doc"><p>Append two paths.</p><p>The second argument must always be a relative path, which ensures
|
||
|
that undefinable things like `"<em>abc" <</em>> "/def"` cannot happen.</p><p>Technically, the first argument can be a path that points to a non-directory,
|
||
|
because this library is IO-agnostic and makes no assumptions about
|
||
|
file types.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/") </> (MkPath "file" :: Path Rel)
|
||
|
</code></strong>"/file"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/path/to") </> (MkPath "file" :: Path Rel)
|
||
|
</code></strong>"/path/to/file"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/") </> (MkPath "file/lal" :: Path Rel)
|
||
|
</code></strong>"/file/lal"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/") </> (MkPath "file/" :: Path Rel)
|
||
|
</code></strong>"/file/"
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:basename" class="def">basename</a> :: MonadThrow m => <a href="HPath.html#t:Path">Path</a> b -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Fn">Fn</a>) <a href="src/HPath.html#basename" class="link">Source</a> <a href="#v:basename" class="selflink">#</a></p><div class="doc"><p>Extract the file part of a path.</p><p>The following properties hold:</p><pre>basename (p </> a) == basename a</pre><p>Throws: <code><a href="HPath.html#t:PathException">PathException</a></code> if given the root path "/"</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>basename (MkPath "/abc/def/dod") :: Maybe (Path Fn)
|
||
|
</code></strong>Just "dod"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>basename (MkPath "/") :: Maybe (Path Fn)
|
||
|
</code></strong>Nothing
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:dirname" class="def">dirname</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a> -> <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a> <a href="src/HPath.html#dirname" class="link">Source</a> <a href="#v:dirname" class="selflink">#</a></p><div class="doc"><p>Extract the directory name of a path.</p><p>The following properties hold:</p><pre>dirname (p </> a) == dirname p</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>dirname (MkPath "/abc/def/dod")
|
||
|
</code></strong>"/abc/def"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>dirname (MkPath "/")
|
||
|
</code></strong>"/"
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:isParentOf" class="def">isParentOf</a> :: <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> Bool <a href="src/HPath.html#isParentOf" class="link">Source</a> <a href="#v:isParentOf" class="selflink">#</a></p><div class="doc"><p>Is p a parent of the given location? Implemented in terms of
|
||
|
<code><a href="HPath.html#v:stripDir">stripDir</a></code>. The bases must match.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/lal/lad") `isParentOf` (MkPath "/lal/lad/fad")
|
||
|
</code></strong>True
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "lal/lad") `isParentOf` (MkPath "lal/lad/fad")
|
||
|
</code></strong>True
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/") `isParentOf` (MkPath "/")
|
||
|
</code></strong>False
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/lal/lad/fad") `isParentOf` (MkPath "/lal/lad")
|
||
|
</code></strong>False
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "fad") `isParentOf` (MkPath "fad")
|
||
|
</code></strong>False
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:getAllParents" class="def">getAllParents</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a> -> [<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a>] <a href="src/HPath.html#getAllParents" class="link">Source</a> <a href="#v:getAllParents" class="selflink">#</a></p><div class="doc"><p>Get all parents of a path.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>getAllParents (MkPath "/abs/def/dod")
|
||
|
</code></strong>["/abs/def","/abs","/"]
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>getAllParents (MkPath "/")
|
||
|
</code></strong>[]
|
||
|
</pre></div></div><div class="top"><p class="src"><a id="v:stripDir" class="def">stripDir</a> :: MonadThrow m => <a href="HPath.html#t:Path">Path</a> b -> <a href="HPath.html#t:Path">Path</a> b -> m (<a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Rel">Rel</a>) <a href="src/HPath.html#stripDir" class="link">Source</a> <a href="#v:stripDir" class="selflink">#</a></p><div class="doc"><p>Strip directory from path, making it relative to that directory.
|
||
|
Throws <code>Couldn'tStripPrefixDir</code> if directory is not a parent of the path.</p><p>The bases must match.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/lal/lad") `stripDir` (MkPath "/lal/lad/fad") :: Maybe (Path Rel)
|
||
|
</code></strong>Just "fad"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "lal/lad") `stripDir` (MkPath "lal/lad/fad") :: Maybe (Path Rel)
|
||
|
</code></strong>Just "fad"
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/") `stripDir` (MkPath "/") :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "/lal/lad/fad") `stripDir` (MkPath "/lal/lad") :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
<code class="prompt">>>> </code><strong class="userinput"><code>(MkPath "fad") `stripDir` (MkPath "fad") :: Maybe (Path Rel)
|
||
|
</code></strong>Nothing
|
||
|
</pre></div></div><h1 id="g:6">Path IO helpers</h1><div class="top"><p class="src"><a id="v:withAbsPath" class="def">withAbsPath</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Abs">Abs</a> -> (<a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> IO a) -> IO a <a href="src/HPath.html#withAbsPath" class="link">Source</a> <a href="#v:withAbsPath" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:withRelPath" class="def">withRelPath</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Rel">Rel</a> -> (<a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> IO a) -> IO a <a href="src/HPath.html#withRelPath" class="link">Source</a> <a href="#v:withRelPath" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:withFnPath" class="def">withFnPath</a> :: <a href="HPath.html#t:Path">Path</a> <a href="HPath.html#t:Fn">Fn</a> -> (<a href="https://hackage.haskell.org/package/utf8-string-0.3.7/docs/Data-ByteString-UTF8.html#t:ByteString">ByteString</a> -> IO a) -> IO a <a href="src/HPath.html#withFnPath" class="link">Source</a> <a href="#v:withFnPath" class="selflink">#</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>
|