<!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:anyFailed"class="def">anyFailed</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#anyFailed"class="link">Source</a><ahref="#v:anyFailed"class="selflink">#</a></p><divclass="doc"><p>True if any Failed constructors in the tree.</p></div></div><divclass="top"><pclass="src"><aid="v:successful"class="def">successful</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#successful"class="link">Source</a><ahref="#v:successful"class="selflink">#</a></p><divclass="doc"><p>True if there are no Failed constructors in the tree.</p></div></div><divclass="top"><pclass="src"><aid="v:failed"class="def">failed</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#failed"class="link">Source</a><ahref="#v:failed"class="selflink">#</a></p><divclass="doc"><p>Returns true if argument is a <code><ahref="HSFM-FileSystem-FileType.html#v:Failed">Failed</a></code> constructor.</p></div></div><divclass="top"><pclass="src"><aid="v:failures"class="def">failures</a> :: [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a] -> [<ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a] <ahref="src/HSFM-FileSystem-FileType.html#failures"class="link">Source</a><ahref="#v:failures"class="selflink">#</a></p><divclass="doc"><p>Returns a list of <code><ahref="HSFM-FileSystem-FileType.html#v:Failed">Failed</a></code> constructors only.</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="selfl
Otherwise, returns the file unchanged.</p></div></div><divclass="top"><pclass="src"><aid="v:isBrokenSymlink"class="def">isBrokenSymlink</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-Bool.html#t:Bool">Bool</a><ahref="src/HSFM-FileSystem-FileType.html#isBrokenSymlink"class="link">Source</a><ahref="#v:isBrokenSymlink"class="selflink">#</a></p><divclass="doc"><p>Checks if a symlink is broken by examining the constructor of the
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:fromFreeVar"class="def">fromFreeVar</a> :: Default d => (a -> d) -><ahref="HSFM-FileSystem-FileType.html#t:File">File</a> a -> d <ahref="src/HSFM-FileSystem-FileType.html#fromFreeVar"class="link">Source</a><ahref="#v:fromFreeVar"class="selflink">#</a></p><divclass="doc"><p>Apply a function on the free variable. If there is no free variable
for the given constructor the value from the <code>Default</code> class is used.</p></div></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><divclass="top"><pclass="src"><aid="v:getFreeVar"class="def">getFreeVar</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> a <ahref="src/HSFM-FileSystem-FileType.html#getFreeVar"class="link">Source</a><ahref="#v:getFreeVar"class="selflink">#</a></p><divclass="doc"><p>Gets the free variable. Returns Nothing if the constructor is of <code><ahref="HSFM-FileSystem-FileType.html#v:Failed">Failed</a></code>.</p></div></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>