<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>HSFM.FileSystem.FileType</title><linkhref="ocean.css"rel="stylesheet"type="text/css"title="Ocean"/><scriptsrc="haddock-util.js"type="text/javascript"></script><scripttype="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_HSFM-FileSystem-FileType.html");};
//]]>
</script></head><body><divid="package-header"><ulclass="links"id="page-menu"><li><ahref="src/HSFM-FileSystem-FileType.html">Source</a></li><li><ahref="index.html">Contents</a></li><li><ahref="doc-index.html">Index</a></li></ul><pclass="caption">hsfm-gtk</p></div><divid="content"><divid="module-header"><tableclass="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><pclass="caption">HSFM.FileSystem.FileType</p></div><divid="description"><pclass="caption">Description</p><divclass="doc"><p>This module provides a data type for representing directories/files
in a well-typed and convenient way. This is useful to gather and
save information about a file, so the information can be easily
processed in e.g. a GUI.</p><p>However, it's not meant to be used to interact with low-level
functions that copy files etc, since there's no guarantee that
the in-memory representation of the type still matches what is
happening on filesystem level.</p><p>If you interact with low-level libraries, you must not pattern
match on the `File a` type. Instead, you should only use the saved
<code><ahref="HSFM-FileSystem-FileType.html#v:path">path</a></code> and make no assumptions about the file the path might or
Then compare free variable parameter of <code><ahref="HSFM-FileSystem-FileType.html#t:File">File</a></code> constructors</p></td></tr></table></div></div></div><divclass="top"><pclass="src"><aname="v:sfileLike"class="def">sfileLike</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -> (<ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a>, <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#sfileLike"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:fileLike"class="def">fileLike</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -> (<ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a>, <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#fileLike"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:sdir"class="def">sdir</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -> (<ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a>, <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#sdir"class="link">Source</a></p></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:FileLike"class="def">FileLike</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a><ahref="src/HSFM-FileSystem-FileType.html#FileLike"class="link">Source</a></p><divclass="doc"><p>Matches on any non-directory kind of files, excluding symlinks.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:DirList"class="def">DirList</a> :: [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>] -> [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>] <ahref="src/HSFM-FileSystem-FileType.html#DirList"class="link">Source</a></p><divclass="doc"><p>Matches a list of directories or symlinks pointing to directories.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:FileLikeList"class="def">FileLikeList</a> :: [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>] -> [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>] <ahref="src/HSFM-FileSystem-FileType.html#FileLikeList"class="link">Source</a></p><divclass="doc"><p>Matches a list of any non-directory kind of files or symlinks
pointing to such.</p></div></div><divclass="top"><pclass="src"><aname="v:brokenSymlink"class="def">brokenSymlink</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -> (<ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a>, <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#brokenSymlink"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:fileLikeSym"class="def">fileLikeSym</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -> (<ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a>, <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#fileLikeSym"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:dirSym"class="def">dirSym</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -> (<ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a>, <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#dirSym"class="link">Source</a></p></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:FileLikeSym"class="def">FileLikeSym</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a><ahref="src/HSFM-FileSystem-FileType.html#FileLikeSym"class="link">Source</a></p><divclass="doc"><p>Matches on symlinks pointing to file-like files only.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:BrokenSymlink"class="def">BrokenSymlink</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a><ahref="src/HSFM-FileSystem-FileType.html#BrokenSymlink"class="link">Source</a></p><divclass="doc"><p>Matches on broken symbolic links.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:DirOrSym"class="def">DirOrSym</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a><ahref="src/HSFM-FileSystem-FileType.html#DirOrSym"class="link">Source</a></p><divclass="doc"><p>Matches on directories or symlinks pointing to directories.
chain, not the last.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:DirSym"class="def">DirSym</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a><ahref="src/HSFM-FileSystem-FileType.html#DirSym"class="link">Source</a></p><divclass="doc"><p>Matches on symlinks pointing to directories only.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aname="v:FileLikeOrSym"class="def">FileLikeOrSym</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a><ahref="src/HSFM-FileSystem-FileType.html#FileLikeOrSym"class="link">Source</a></p><divclass="doc"><p>Matches on any non-directory kind of files or symlinks pointing to
chain, not the last.</p></div></div><divclass="top"><pclass="src"><aname="v:readFile"class="def">readFile</a> :: (Path Abs -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> a) -> Path Abs -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> (<ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a) <ahref="src/HSFM-FileSystem-FileType.html#readFile"class="link">Source</a></p><divclass="doc"><p>Reads a file or directory Path into an <code>AnchoredFile</code>, filling the free
variables via the given function.</p></div></div><divclass="top"><pclass="src"><aname="v:readDirectoryContents"class="def">readDirectoryContents</a><ahref="src/HSFM-FileSystem-FileType.html#readDirectoryContents"class="link">Source</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: (Path Abs -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> a)</td><tdclass="doc"><p>fills free a variable</p></td></tr><tr><tdclass="src">-> Path Abs</td><tdclass="doc"><p>path to read</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a]</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Get the contents of a given directory and return them as a list
of <code>AnchoredFile</code>.</p></div></div><divclass="top"><pclass="src"><aname="v:getContents"class="def">getContents</a> :: (Path Abs -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> a) -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a] <ahref="src/HSFM-FileSystem-FileType.html#getContents"class="link">Source</a></p><divclass="doc"><p>A variant of <code><ahref="HSFM-FileSystem-FileType.html#v:readDirectoryContents">readDirectoryContents</a></code> where the second argument
is a <code><ahref="HSFM-FileSystem-FileType.html#t:File">File</a></code>. If a non-directory is passed returns an empty list.</p></div></div><divclass="top"><pclass="src"><aname="v:goUp"class="def">goUp</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> (<ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#goUp"class="link">Source</a></p><divclass="doc"><p>Go up one directory in the filesystem hierarchy.</p></div></div><divclass="top"><pclass="src"><aname="v:goUp-39-"class="def">goUp'</a> :: Path Abs -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-IO.html#t:IO">IO</a> (<ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a>) <ahref="src/HSFM-FileSystem-FileType.html#goUp%27"class="link">Source</a></p><divclass="doc"><p>Go up one directory in the filesystem hierarchy.</p></div></div><divclass="top"><pclass="src"><aname="v:comparingConstr"class="def">comparingConstr</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Ord.html#t:Ordering">Ordering</a><ahref="src/HSFM-FileSystem-FileType.html#comparingConstr"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isFileC"class="def">isFileC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isFileC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isDirC"class="def">isDirC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isDirC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isSymC"class="def">isSymC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isSymC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isBlockC"class="def">isBlockC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isBlockC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isCharC"class="def">isCharC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isCharC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isNamedC"class="def">isNamedC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isNamedC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:isSocketC"class="def">isSocketC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isSocketC"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:getFileInfo"class="def">getFileInfo</a> :: Path Abs ->
symlink destination.</p><p>When called on a non-symlink, returns False.</p></div></div><divclass="top"><pclass="src"><aname="v:packModTime"class="def">packModTime</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packModTime"class="link">Source</a></p><divclass="doc"><p>Pack the modification time into a string.</p></div></div><divclass="top"><pclass="src"><aname="v:packAccessTime"class="def">packAccessTime</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packAccessTime"class="link">Source</a></p><divclass="doc"><p>Pack the modification time into a string.</p></div></div><divclass="top"><pclass="src"><aname="v:epochToString"class="def">epochToString</a> :: <ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/System-Posix-Types.html#t:EpochTime">EpochTime</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#epochToString"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:packPermissions"class="def">packPermissions</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a><ahref="HSFM-FileSystem-FileType.html#t:FileInfo">FileInfo</a> -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packPermissions"class="link">Source</a></p><divclass="doc"><p>Pack the permissions into a string, similar to what "ls -l" does.</p></div></div><divclass="top"><pclass="src"><aname="v:packFileType"class="def">packFileType</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packFileType"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:packLinkDestination"class="def">packLinkDestination</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Maybe.html#t:Maybe">Maybe</a><ahref="https://hackage.haskell.org/package/bytestring-0.10.6.0/docs/Data-ByteString.html#t:ByteString">ByteString</a><ahref="src/HSFM-FileSystem-FileType.html#packLinkDestination"class="link">Source</a></p></div><divclass="top"><pclass="src"><aname="v:getFPasStr"class="def">getFPasStr</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#getFPasStr"class="link">Source</a></p></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>