Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 77f0c8b2568c8ba86bf4498d38e7ecdc > files > 810

ghc-base-devel-4.2.0.2-8.6.fc14.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>GHC.IO.Handle.FD</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
></SCRIPT
><SCRIPT TYPE="text/javascript"
>window.onload = function () {setSynopsis("mini_GHC-IO-Handle-FD.html")};</SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
>base-4.2.0.2: Basic libraries</TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>GHC.IO.Handle.FD</FONT
></TD
><TD ALIGN="right"
><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="infohead"
>Portability</TD
><TD CLASS="infoval"
>non-portable</TD
></TR
><TR
><TD CLASS="infohead"
>Stability</TD
><TD CLASS="infoval"
>internal</TD
></TR
><TR
><TD CLASS="infohead"
>Maintainer</TD
><TD CLASS="infoval"
>libraries@haskell.org</TD
></TR
></TABLE
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
>Handle operations implemented by file descriptors (FDs)
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><A HREF="#v%3Astdin"
>stdin</A
> :: <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Astdout"
>stdout</A
> :: <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Astderr"
>stderr</A
> :: <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AopenFile"
>openFile</A
> :: <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AopenBinaryFile"
>openBinaryFile</A
> :: <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AmkHandleFromFD"
>mkHandleFromFD</A
> :: FD -&gt; <A HREF="GHC-IO-Device.html#t%3AIODeviceType"
>IODeviceType</A
> -&gt; <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
> -&gt; <A HREF="Data-Maybe.html#t%3AMaybe"
>Maybe</A
> <A HREF="GHC-IO-Encoding-Types.html#t%3ATextEncoding"
>TextEncoding</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AfdToHandle"
>fdToHandle</A
> :: FD -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AfdToHandle%27"
>fdToHandle'</A
> :: <A HREF="Foreign-C-Types.html#t%3ACInt"
>CInt</A
> -&gt; <A HREF="Data-Maybe.html#t%3AMaybe"
>Maybe</A
> <A HREF="GHC-IO-Device.html#t%3AIODeviceType"
>IODeviceType</A
> -&gt; <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
> -&gt; <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AisEOF"
>isEOF</A
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:stdin"
><A NAME="v%3Astdin"
></A
></A
><B
>stdin</B
> :: <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
>A handle managing input from the Haskell program's standard input channel.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:stdout"
><A NAME="v%3Astdout"
></A
></A
><B
>stdout</B
> :: <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
>A handle managing output to the Haskell program's standard output channel.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:stderr"
><A NAME="v%3Astderr"
></A
></A
><B
>stderr</B
> :: <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
>A handle managing output to the Haskell program's standard error channel.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:openFile"
><A NAME="v%3AopenFile"
></A
></A
><B
>openFile</B
> :: <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Computation <TT
><A HREF="GHC-IO-Handle-FD.html#v%3AopenFile"
>openFile</A
></TT
> <TT
>file mode</TT
> allocates and returns a new, open
 handle to manage the file <TT
>file</TT
>.  It manages input if <TT
>mode</TT
>
 is <TT
><A HREF="System-IO.html#v%3AReadMode"
>ReadMode</A
></TT
>, output if <TT
>mode</TT
> is <TT
><A HREF="System-IO.html#v%3AWriteMode"
>WriteMode</A
></TT
> or <TT
><A HREF="System-IO.html#v%3AAppendMode"
>AppendMode</A
></TT
>,
 and both input and output if mode is <TT
><A HREF="System-IO.html#v%3AReadWriteMode"
>ReadWriteMode</A
></TT
>.
</P
><P
>If the file does not exist and it is opened for output, it should be
 created as a new file.  If <TT
>mode</TT
> is <TT
><A HREF="System-IO.html#v%3AWriteMode"
>WriteMode</A
></TT
> and the file
 already exists, then it should be truncated to zero length.
 Some operating systems delete empty files, so there is no guarantee
 that the file will exist following an <TT
><A HREF="GHC-IO-Handle-FD.html#v%3AopenFile"
>openFile</A
></TT
> with <TT
>mode</TT
>
 <TT
><A HREF="System-IO.html#v%3AWriteMode"
>WriteMode</A
></TT
> unless it is subsequently written to successfully.
 The handle is positioned at the end of the file if <TT
>mode</TT
> is
 <TT
><A HREF="System-IO.html#v%3AAppendMode"
>AppendMode</A
></TT
>, and otherwise at the beginning (in which case its
 internal position is 0).
 The initial buffer mode is implementation-dependent.
</P
><P
>This operation may fail with:
</P
><UL
><LI
> isAlreadyInUseError if the file is already open and cannot be reopened;
</LI
><LI
> isDoesNotExistError if the file does not exist; or
</LI
><LI
> isPermissionError if the user does not have permission to open the file.
</LI
></UL
><P
>Note: if you will be working with files containing binary data, you'll want to
 be using <TT
><A HREF="GHC-IO-Handle-FD.html#v%3AopenBinaryFile"
>openBinaryFile</A
></TT
>.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:openBinaryFile"
><A NAME="v%3AopenBinaryFile"
></A
></A
><B
>openBinaryFile</B
> :: <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
>Like <TT
><A HREF="GHC-IO-Handle-FD.html#v%3AopenFile"
>openFile</A
></TT
>, but open the file in binary mode.
 On Windows, reading a file in text mode (which is the default)
 will translate CRLF to LF, and writing will translate LF to CRLF.
 This is usually what you want with text files.  With binary files
 this is undesirable; also, as usual under Microsoft operating systems,
 text mode treats control-Z as EOF.  Binary mode turns off all special
 treatment of end-of-line and end-of-file characters.
 (See also <TT
><A HREF="GHC-IO-Handle.html#v%3AhSetBinaryMode"
>hSetBinaryMode</A
></TT
>.)
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:mkHandleFromFD"
><A NAME="v%3AmkHandleFromFD"
></A
></A
><B
>mkHandleFromFD</B
> :: FD -&gt; <A HREF="GHC-IO-Device.html#t%3AIODeviceType"
>IODeviceType</A
> -&gt; <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
> -&gt; <A HREF="Data-Maybe.html#t%3AMaybe"
>Maybe</A
> <A HREF="GHC-IO-Encoding-Types.html#t%3ATextEncoding"
>TextEncoding</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:fdToHandle"
><A NAME="v%3AfdToHandle"
></A
></A
><B
>fdToHandle</B
> :: FD -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
><P
>Turn an existing file descriptor into a Handle.  This is used by
 various external libraries to make Handles.
</P
><P
>Makes a binary Handle.  This is for historical reasons; it should
 probably be a text Handle with the default encoding and newline
 translation instead.
</P
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:fdToHandle'"
><A NAME="v%3AfdToHandle%27"
></A
></A
><B
>fdToHandle'</B
> :: <A HREF="Foreign-C-Types.html#t%3ACInt"
>CInt</A
> -&gt; <A HREF="Data-Maybe.html#t%3AMaybe"
>Maybe</A
> <A HREF="GHC-IO-Device.html#t%3AIODeviceType"
>IODeviceType</A
> -&gt; <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
> -&gt; <A HREF="System-IO.html#t%3AFilePath"
>FilePath</A
> -&gt; <A HREF="System-IO.html#t%3AIOMode"
>IOMode</A
> -&gt; <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
> -&gt; <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="GHC-IO-Handle.html#t%3AHandle"
>Handle</A
></TD
></TR
><TR
><TD CLASS="doc"
>Old API kept to avoid breaking clients
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v:isEOF"
><A NAME="v%3AisEOF"
></A
></A
><B
>isEOF</B
> :: <A HREF="System-IO.html#t%3AIO"
>IO</A
> <A HREF="Data-Bool.html#t%3ABool"
>Bool</A
></TD
></TR
><TR
><TD CLASS="doc"
>The computation <TT
><A HREF="GHC-IO-Handle-FD.html#v%3AisEOF"
>isEOF</A
></TT
> is identical to <TT
><A HREF="GHC-IO-Handle.html#v%3AhIsEOF"
>hIsEOF</A
></TT
>,
 except that it works only on <TT
><A HREF="GHC-IO-Handle-FD.html#v%3Astdin"
>stdin</A
></TT
>.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 2.6.1</TD
></TR
></TABLE
></BODY
></HTML
>