<!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>Filesystem.Path.Rules</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_Filesystem-Path-Rules.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Filesystem-Path-Rules.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">system-filepath-0.4.7: High-level, byte-based file and directory path manipulations</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Maintainer</th><td>jmillikin@gmail.com</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Filesystem.Path.Rules</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Type conversions </a></li><li><a href="#g:2">Rule‐specific path properties </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc empty"> </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:Rules">Rules</a> platformFormat</li><li class="src short"><a href="#v:posix">posix</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:posix_ghc702">posix_ghc702</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:posix_ghc704">posix_ghc704</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:windows">windows</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:darwin">darwin</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:darwin_ghc702">darwin_ghc702</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:toText">toText</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:fromText">fromText</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:encode">encode</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> platformFormat</li><li class="src short"><a href="#v:decode">decode</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:encodeString">encodeString</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:decodeString">decodeString</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:valid">valid</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:splitSearchPath">splitSearchPath</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> platformFormat -> [<a href="Filesystem-Path.html#t:FilePath">FilePath</a>]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Rules" class="def">Rules</a> platformFormat <a href="src/Filesystem-Path-Internal.html#Rules" class="link">Source</a></p><div class="subs instances"><p id="control.i:Rules" class="caption collapser" onclick="toggleSection('i:Rules')">Instances</p><div id="section.i:Rules" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Text-Show.html#t:Show">Show</a> (<a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> a)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:posix" class="def">posix</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Filesystem-Path-Rules.html#posix" class="link">Source</a></p><div class="doc"><p>Linux, BSD, and other UNIX or UNIX-like operating systems. </p></div></div><div class="top"><p class="src"><a name="v:posix_ghc702" class="def">posix_ghc702</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Filesystem-Path-Rules.html#posix_ghc702" class="link">Source</a></p><div class="doc"><p>Linux, BSD, and other UNIX or UNIX-like operating systems. </p><p>This is a variant of <code><a href="Filesystem-Path-Rules.html#v:posix">posix</a></code> for use with GHC 7.2, which tries to decode file paths in its IO computations. </p><p>Since: 0.3.3 / 0.4.2 </p></div></div><div class="top"><p class="src"><a name="v:posix_ghc704" class="def">posix_ghc704</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a><a href="src/Filesystem-Path-Rules.html#posix_ghc704" class="link">Source</a></p><div class="doc"><p>Linux, BSD, and other UNIX or UNIX-like operating systems. </p><p>This is a variant of <code><a href="Filesystem-Path-Rules.html#v:posix">posix</a></code> for use with GHC 7.4 or later, which tries to decode file paths in its IO computations. </p><p>Since: 0.3.7 / 0.4.6 </p></div></div><div class="top"><p class="src"><a name="v:windows" class="def">windows</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a><a href="src/Filesystem-Path-Rules.html#windows" class="link">Source</a></p><div class="doc"><p>Windows and DOS </p></div></div><div class="top"><p class="src"><a name="v:darwin" class="def">darwin</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a><a href="src/Filesystem-Path-Rules.html#darwin" class="link">Source</a></p><div class="doc"><p>Darwin and Mac OS X. </p><p>This is almost identical to <code><a href="Filesystem-Path-Rules.html#v:posix">posix</a></code>, but with a native path type of <code><a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a></code> rather than <code><a href="/usr/share/doc/ghc/html/libraries/bytestring-0.9.2.1/Data-ByteString.html#t:ByteString">ByteString</a></code>. </p><p>Since: 0.3.4 / 0.4.3 </p></div></div><div class="top"><p class="src"><a name="v:darwin_ghc702" class="def">darwin_ghc702</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a><a href="src/Filesystem-Path-Rules.html#darwin_ghc702" class="link">Source</a></p><div class="doc"><p>Darwin and Mac OS X. </p><p>This is a variant of <code><a href="Filesystem-Path-Rules.html#v:darwin">darwin</a></code> for use with GHC 7.2 or later, which tries to decode file paths in its IO computations. </p><p>Since: 0.3.4 / 0.4.3 </p></div></div><h1 id="g:1">Type conversions </h1><div class="top"><p class="src"><a name="v:toText" class="def">toText</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a><a href="src/Filesystem-Path-Internal.html#toText" class="link">Source</a></p><div class="doc"><p>Attempt to convert a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code> to human‐readable text. </p><p>If the path is decoded successfully, the result is a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Either.html#v:Right">Right</a></code> containing the decoded text. Successfully decoded text can be converted back to the original path using <code><a href="Filesystem-Path-Rules.html#v:fromText">fromText</a></code>. </p><p>If the path cannot be decoded, the result is a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Either.html#v:Left">Left</a></code> containing an approximation of the original path. If displayed to the user, this value should be accompanied by some warning that the path has an invalid encoding. Approximated text cannot be converted back to the original path. </p><p>This function ignores the user’s locale, and assumes all file paths are encoded in UTF8. If you need to display file paths with an unusual or obscure encoding, use <code><a href="Filesystem-Path-Rules.html#v:encode">encode</a></code> and then decode them manually. </p><p>Since: 0.2 </p></div></div><div class="top"><p class="src"><a name="v:fromText" class="def">fromText</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="/usr/share/doc/ghc/html/libraries/text-0.11.2.0/Data-Text-Internal.html#t:Text">Text</a> -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a><a href="src/Filesystem-Path-Internal.html#fromText" class="link">Source</a></p><div class="doc"><p>Convert human‐readable text into a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code>. </p><p>This function ignores the user’s locale, and assumes all file paths are encoded in UTF8. If you need to create file paths with an unusual or obscure encoding, encode them manually and then use <code><a href="Filesystem-Path-Rules.html#v:decode">decode</a></code>. </p><p>Since: 0.2 </p></div></div><div class="top"><p class="src"><a name="v:encode" class="def">encode</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> platformFormat<a href="src/Filesystem-Path-Internal.html#encode" class="link">Source</a></p><div class="doc"><p>Convert a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code> to a platform‐specific format, suitable for use with external OS functions. </p><p>Since: 0.3 </p></div></div><div class="top"><p class="src"><a name="v:decode" class="def">decode</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a><a href="src/Filesystem-Path-Internal.html#decode" class="link">Source</a></p><div class="doc"><p>Convert a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code> from a platform‐specific format, suitable for use with external OS functions. </p><p>Since: 0.3 </p></div></div><div class="top"><p class="src"><a name="v:encodeString" class="def">encodeString</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a><a href="src/Filesystem-Path-Internal.html#encodeString" class="link">Source</a></p><div class="doc"><p>Attempt to convert a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code> to a string suitable for use with functions in <code>System.IO</code>. The contents of this string are platform‐dependent, and are not guaranteed to be human‐readable. For converting <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code>s to a human‐readable format, use <code><a href="Filesystem-Path-Rules.html#v:toText">toText</a></code>. </p><p>Since: 0.3.1 </p></div></div><div class="top"><p class="src"><a name="v:decodeString" class="def">decodeString</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a><a href="src/Filesystem-Path-Internal.html#decodeString" class="link">Source</a></p><div class="doc"><p>Attempt to parse a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code> from a string suitable for use with functions in <code>System.IO</code>. Do not use this function for parsing human‐readable paths, as the character set decoding is platform‐dependent. For converting human‐readable text to a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code>, use <code><a href="Filesystem-Path-Rules.html#v:fromText">fromText</a></code>. </p><p>Since: 0.3.1 </p></div></div><h1 id="g:2">Rule‐specific path properties </h1><div class="top"><p class="src"><a name="v:valid" class="def">valid</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> <a href="Filesystem-Path.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Filesystem-Path-Internal.html#valid" class="link">Source</a></p><div class="doc"><p>Check if a <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code> is valid; it must not contain any illegal characters, and must have a root appropriate to the current <code><a href="Filesystem-Path-Rules.html#t:Rules">Rules</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:splitSearchPath" class="def">splitSearchPath</a> :: <a href="Filesystem-Path-Rules.html#t:Rules">Rules</a> platformFormat -> platformFormat -> [<a href="Filesystem-Path.html#t:FilePath">FilePath</a>]<a href="src/Filesystem-Path-Internal.html#splitSearchPath" class="link">Source</a></p><div class="doc"><p>Split a search path, such as <code>$PATH</code> or <code>$PYTHONPATH</code>, into a list of <code><a href="Filesystem-Path.html#t:FilePath">FilePath</a></code>s. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>