/usr/share/doc/libghc-text-doc/html/Data-Text-IO.html is in libghc-text-doc 0.11.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <!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>Data.Text.IO</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_Data-Text-IO.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text-IO.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">text-0.11.3.1: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>GHC</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Data.Text.IO</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Performance
</a></li><li><a href="#g:2">Locale support
</a></li><li><a href="#g:3">Operations on handles
</a></li><li><a href="#g:4">Special cases for standard input and output
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Efficient locale-sensitive support for text I/O.
</p><p>Skip past the synopsis for some important notes on performance and
portability across different versions of GHC.
</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"><a href="#v:readFile">readFile</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:writeFile">writeFile</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:appendFile">appendFile</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:hGetContents">hGetContents</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:hGetChunk">hGetChunk</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:hGetLine">hGetLine</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:hPutStr">hPutStr</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:hPutStrLn">hPutStrLn</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:interact">interact</a> :: (<a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a>) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getContents">getContents</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:getLine">getLine</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a></li><li class="src short"><a href="#v:putStr">putStr</a> :: <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:putStrLn">putStrLn</a> :: <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()</li></ul></div><div id="interface"><h1 id="g:1">Performance
</h1><div class="doc"><p><a name="performance"></a>
</p><p>The functions in this module obey the runtime system's locale,
character set encoding, and line ending conversion settings.
</p><p>If you know in advance that you will be working with data that has
a specific encoding (e.g. UTF-8), and your application is highly
performance sensitive, you may find that it is faster to perform
I/O with bytestrings and to encode and decode yourself than to use
the functions in this module.
</p><p>Whether this will hold depends on the version of GHC you are using,
the platform you are working on, the data you are working with, and
the encodings you are using, so be sure to test for yourself.
</p></div><h1 id="g:2">Locale support
</h1><div class="doc"><p><em>Note</em>: The behaviour of functions in this module depends on the
version of GHC you are using.
</p><p>Beginning with GHC 6.12, text I/O is performed using the system or
handle's current locale and line ending conventions.
</p><p>Under GHC 6.10 and earlier, the system I/O libraries do not
support locale-sensitive I/O or line ending conversion. On these
versions of GHC, functions in this library all use UTF-8. What
does this mean in practice?
</p><ul><li> All data that is read will be decoded as UTF-8.
</li><li> Before data is written, it is first encoded as UTF-8.
</li><li> On both reading and writing, the platform's native newline
conversion is performed.
</li></ul><p>If you must use a non-UTF-8 locale on an older version of GHC, you
will have to perform the transcoding yourself, e.g. as follows:
</p><pre> import qualified Data.ByteString as B
import Data.Text (Text)
import Data.Text.Encoding (encodeUtf16)
putStr_Utf16LE :: Text -> IO ()
putStr_Utf16LE t = B.putStr (encodeUtf16LE t)
</pre></div><div class="top"><p class="src"><a name="v:readFile" class="def">readFile</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:FilePath">FilePath</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a><a href="src/Data-Text-IO.html#readFile" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Text-IO.html#v:readFile">readFile</a></code> function reads a file and returns the contents of
the file as a string. The entire file is read strictly, as with
<code><a href="Data-Text-IO.html#v:getContents">getContents</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:writeFile" class="def">writeFile</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#writeFile" class="link">Source</a></p><div class="doc"><p>Write a string to a file. The file is truncated to zero length
before writing begins.
</p></div></div><div class="top"><p class="src"><a name="v:appendFile" class="def">appendFile</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:FilePath">FilePath</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#appendFile" class="link">Source</a></p><div class="doc"><p>Write a string the end of a file.
</p></div></div><h1 id="g:3">Operations on handles
</h1><div class="top"><p class="src"><a name="v:hGetContents" class="def">hGetContents</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a><a href="src/Data-Text-IO.html#hGetContents" class="link">Source</a></p><div class="doc"><p>Read the remaining contents of a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a></code> as a string. The
<code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a></code> is closed once the contents have been read, or if an
exception is thrown.
</p><p>Internally, this function reads a chunk at a time from the
lower-level buffering abstraction, and concatenates the chunks into
a single string once the entire file has been read.
</p><p>As a result, it requires approximately twice as much memory as its
result to construct its result. For files more than a half of
available RAM in size, this may result in memory exhaustion.
</p></div></div><div class="top"><p class="src"><a name="v:hGetChunk" class="def">hGetChunk</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a><a href="src/Data-Text-IO.html#hGetChunk" class="link">Source</a></p><div class="doc"><p><em>Experimental.</em> Read a single chunk of strict text from a
<code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a></code>. The size of the chunk depends on the amount of input
currently buffered.
</p><p>This function blocks only if there is no data available, and EOF
has not yet been reached. Once EOF is reached, this function
returns an empty string instead of throwing an exception.
</p></div></div><div class="top"><p class="src"><a name="v:hGetLine" class="def">hGetLine</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a><a href="src/Data-Text-IO.html#hGetLine" class="link">Source</a></p><div class="doc"><p>Read a single line from a handle.
</p></div></div><div class="top"><p class="src"><a name="v:hPutStr" class="def">hPutStr</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#hPutStr" class="link">Source</a></p><div class="doc"><p>Write a string to a handle.
</p></div></div><div class="top"><p class="src"><a name="v:hPutStrLn" class="def">hPutStrLn</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#hPutStrLn" class="link">Source</a></p><div class="doc"><p>Write a string to a handle, followed by a newline.
</p></div></div><h1 id="g:4">Special cases for standard input and output
</h1><div class="top"><p class="src"><a name="v:interact" class="def">interact</a> :: (<a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="Data-Text-Internal.html#t:Text">Text</a>) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#interact" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Text-IO.html#v:interact">interact</a></code> function takes a function of type <code>Text -> Text</code>
as its argument. The entire input from the standard input device is
passed to this function as its argument, and the resulting string
is output on the standard output device.
</p></div></div><div class="top"><p class="src"><a name="v:getContents" class="def">getContents</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a><a href="src/Data-Text-IO.html#getContents" class="link">Source</a></p><div class="doc"><p>Read all user input on <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle-FD.html#v:stdin">stdin</a></code> as a single string.
</p></div></div><div class="top"><p class="src"><a name="v:getLine" class="def">getLine</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> <a href="Data-Text-Internal.html#t:Text">Text</a><a href="src/Data-Text-IO.html#getLine" class="link">Source</a></p><div class="doc"><p>Read a single line of user input from <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle-FD.html#v:stdin">stdin</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:putStr" class="def">putStr</a> :: <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#putStr" class="link">Source</a></p><div class="doc"><p>Write a string to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle-FD.html#v:stdout">stdout</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:putStrLn" class="def">putStrLn</a> :: <a href="Data-Text-Internal.html#t:Text">Text</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/System-IO.html#t:IO">IO</a> ()<a href="src/Data-Text-IO.html#putStrLn" class="link">Source</a></p><div class="doc"><p>Write a string to <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/GHC-IO-Handle-FD.html#v:stdout">stdout</a></code>, followed by a newline.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|