<!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><scriptsrc="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"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
chain, not the last.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aid="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><ahref="#v:DirSym"class="selflink">#</a></p><divclass="doc"><p>Matches on symlinks pointing to directories only.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">pattern</span><aid="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><ahref="#v:FileLikeOrSym"class="selflink">#</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"><aid="v:readFile"class="def">readFile</a> :: (Path Abs -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a) -> Path Abs -><ahref="https://hackage.haskell.org/package/base-4.9.0.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><ahref="#v:readFile"class="selflink">#</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"><aid="v:readDirectoryContents"class="def">readDirectoryContents</a><ahref="src/HSFM-FileSystem-FileType.html#readDirectoryContents"class="link">Source</a><ahref="#v:readDirectoryContents"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: (Path Abs -><ahref="https://hackage.haskell.org/package/base-4.9.0.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.9.0.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"><aid="v:getContents"class="def">getContents</a> :: (Path Abs -><ahref="https://hackage.haskell.org/package/base-4.9.0.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.9.0.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><ahref="#v:getContents"class="selflink">#</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"><aid="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.9.0.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><ahref="#v:goUp"class="selflink">#</a></p><divclass="doc"><p>Go up one directory in the filesystem hierarchy.</p></div></div><divclass="top"><pclass="src"><aid="v:goUp-39-"class="def">goUp'</a> :: Path Abs -><ahref="https://hackage.haskell.org/package/base-4.9.0.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><ahref="#v:goUp-39-"class="selflink">#</a></p><divclass="doc"><p>Go up one directory in the filesystem hierarchy.</p></div></div><divclass="top"><pclass="src"><aid="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.9.0.0/docs/Data-Ord.html#t:Ordering">Ordering</a><ahref="src/HSFM-FileSystem-FileType.html#comparingConstr"class="link">Source</a><ahref="#v:comparingConstr"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isFileC"class="def">isFileC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isFileC"class="link">Source</a><ahref="#v:isFileC"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isDirC"class="def">isDirC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isDirC"class="link">Source</a><ahref="#v:isDirC"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isSymC"class="def">isSymC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isSymC"class="link">Source</a><ahref="#v:isSymC"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isBlockC"class="def">isBlockC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isBlockC"class="link">Source</a><ahref="#v:isBlockC"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isCharC"class="def">isCharC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isCharC"class="link">Source</a><ahref="#v:isCharC"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isNamedC"class="def">isNamedC</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isNamedC"class="link">Source</a><ahref="#v:isNamedC"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:isSock
symlink destination.</p><p>When called on a non-symlink, returns False.</p></div></div><divclass="top"><pclass="src"><aid="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.9.0.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packModTime"class="link">Source</a><ahref="#v:packModTime"class="selflink">#</a></p><divclass="doc"><p>Pack the modification time into a string.</p></div></div><divclass="top"><pclass="src"><aid="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.9.0.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packAccessTime"class="link">Source</a><ahref="#v:packAccessTime"class="selflink">#</a></p><divclass="doc"><p>Pack the modification time into a string.</p></div></div><divclass="top"><pclass="src"><aid="v:epochToString"class="def">epochToString</a> :: <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-Posix-Types.html#t:EpochTime">EpochTime</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#epochToString"class="link">Source</a><ahref="#v:epochToString"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="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.9.0.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packPermissions"class="link">Source</a><ahref="#v:packPermissions"class="selflink">#</a></p><divclass="doc"><p>Pack the permissions into a string, similar to what "ls -l" does.</p></div></div><divclass="top"><pclass="src"><aid="v:packFileType"class="def">packFileType</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#packFileType"class="link">Source</a><ahref="#v:packFileType"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:packLinkDestination"class="def">packLinkDestination</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Maybe.html#t:Maybe">Maybe</a><ahref="https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString.html#t:ByteString">ByteString</a><ahref="src/HSFM-FileSystem-FileType.html#packLinkDestination"class="link">Source</a><ahref="#v:packLinkDestination"class="selflink">#</a></p></div><divclass="top"><pclass="src"><aid="v:getFPasStr"class="def">getFPasStr</a> :: <ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-String.html#t:String">String</a><ahref="src/HSFM-FileSystem-FileType.html#getFPasStr"class="link">Source</a><ahref="#v:getFPasStr"class="selflink">#</a></p></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>