[project @ 2000-01-12 18:05:49 by rrt]
authorrrt <unknown>
Wed, 12 Jan 2000 18:05:49 +0000 (18:05 +0000)
committerrrt <unknown>
Wed, 12 Jan 2000 18:05:49 +0000 (18:05 +0000)
Libraries documentation moved to hslibs tree.

ghc/docs/users_guide/4-04-notes.sgml
ghc/docs/users_guide/ByteArray.sgml [deleted file]
ghc/docs/users_guide/MutableArray.sgml [deleted file]
ghc/docs/users_guide/libmisc.sgml [deleted file]
ghc/docs/users_guide/libraries.sgml
ghc/docs/users_guide/posix.sgml [deleted file]
ghc/docs/users_guide/users_guide.sgml

index e8e6792..69ac428 100644 (file)
@@ -204,7 +204,7 @@ Assertion failures now raise an <Constant>AssertionFailed</Constant> exception.
 
 <ListItem>
 <Para>
-Added simple high-level interface to the Regex library, see <XRef LinkEnd="RegexString">.
+Added simple high-level interface to the Regex library, see the libraries manual.
 </Para>
 </ListItem>
 
diff --git a/ghc/docs/users_guide/ByteArray.sgml b/ghc/docs/users_guide/ByteArray.sgml
deleted file mode 100644 (file)
index b82f1ef..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<Sect2 id="sec-byte-array">
-<Title>The ByteArray
-<IndexTerm><Primary>ByteArray</Primary></IndexTerm>
-interface
-</Title>
-
-<Para>
-<IndexTerm><Primary>ByteArray interface (GHC extensions)</Primary></IndexTerm>
-</Para>
-
-<Para>
-<Literal>ByteArray</Literal>s are chunks of immutable Haskell heap:
-</Para>
-
-<Para>
-
-<ProgramListing>
-data ByteArray ix -- abstract
-                 -- instance of: Eq, CCallable.
-
-newByteArray       :: Ix ix =&#62; (ix,ix) -&#62; ST s (ByteArray ix)
-
-indexCharArray     :: Ix ix =&#62; ByteArray ix -&#62; ix -&#62; Char
-indexIntArray      :: Ix ix =&#62; ByteArray ix -&#62; ix -&#62; Int
-indexAddrArray     :: Ix ix =&#62; ByteArray ix -&#62; ix -&#62; Addr
-indexFloatArray    :: Ix ix =&#62; ByteArray ix -&#62; ix -&#62; Float
-indexDoubleArray   :: Ix ix =&#62; ByteArray ix -&#62; ix -&#62; Double
-
-sizeofByteArray    :: Ix ix =&#62; ByteArray ix -&#62; Int
-</ProgramListing>
-
-<IndexTerm><Primary>newByteArray</Primary></IndexTerm>
-<IndexTerm><Primary>indexCharArray</Primary></IndexTerm>
-<IndexTerm><Primary>indexIntArray</Primary></IndexTerm>
-<IndexTerm><Primary>indexAddrArray</Primary></IndexTerm>
-<IndexTerm><Primary>indexFloatArray</Primary></IndexTerm>
-<IndexTerm><Primary>indexDoubleArray</Primary></IndexTerm>
-<IndexTerm><Primary>indexDoubleArray</Primary></IndexTerm>
-<IndexTerm><Primary>sizeofByteArray</Primary></IndexTerm>
-</Para>
-
-<Para>
-<Emphasis>Remarks:</Emphasis>
-</Para>
-
-<Para>
-
-<ItemizedList>
-<ListItem>
-
-<Para>
-The operation <Function>newByteArray</Function> creates a byte array of length
-equal to the range of its indices <Emphasis>in bytes</Emphasis>.
-</Para>
-</ListItem>
-<ListItem>
-
-<Para>
-<Function>sizeofByteArray</Function> returns the size of the byte array, <Emphasis>in bytes</Emphasis>.
-
-</Para>
-</ListItem>
-<ListItem>
-
-<Para>
-Equality on byte arrays is value equality, not pointer equality (as is
-the case for its mutable variant.) Two byte arrays are equal if
-they're of the same length and they're pairwise equal.
-
-</Para>
-</ListItem>
-
-</ItemizedList>
-
-</Para>
-
-</Sect2>
diff --git a/ghc/docs/users_guide/MutableArray.sgml b/ghc/docs/users_guide/MutableArray.sgml
deleted file mode 100644 (file)
index 4335497..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-<Sect2 id="MutableArray">
-<Title>MutableArray
-<IndexTerm><Primary>MutableArray</Primary></IndexTerm>
-</Title>
-
-<Para>
-The <Literal>MutableArray</Literal> interface provide operations for reading and
-writing values to mutable arrays. There's two kinds of
-mutable arrays, the mutatable version of Haskell <Literal>Array</Literal>s
-and <Emphasis>mutable byte arrays</Emphasis>, chunks of memory containing
-values of some basic type.
-</Para>
-
-<Sect3 id="MutableArray-mutable-arrays">
-<Title>Mutable arrays
-<IndexTerm><Primary>Mutable arrays</Primary></IndexTerm>
-</Title>
-
-<Para>
-The mutable array section of the API provides the following
-operations:
-</Para>
-
-<Para>
-<ProgramListing>
-
--- mutable arrays:
-newArray      :: Ix ix -&#62; (ix,ix) -&#62; elt -&#62; ST s (MutableArray s ix elt)
-boundsOfArray :: Ix ix =&#62; MutableArray s ix elt -&#62; (ix, ix)
-readArray     :: Ix ix =&#62; MutableArray s ix elt -&#62; ix -&#62; ST s elt
-writeArray    :: Ix ix =&#62; MutableArray s ix elt -&#62; ix -&#62; elt -&#62; ST s ()
-freezeArray   :: Ix ix =&#62; MutableArray s ix elt -&#62; ST s (Array ix elt)
-thawArray     :: Ix ix =&#62; Array ix elt -&#62; ST s (MutableArray s ix elt)
-
-unsafeFreezeArray   :: Ix ix =&#62; MutableArray s ix elt -&#62; ST s (Array ix elt)
-unsafeThawArray     :: Ix ix =&#62; Array ix elt -&#62; ST s (MutableArray s ix elt)
-</ProgramListing>
-
-<IndexTerm><Primary>newArray</Primary></IndexTerm>
-<IndexTerm><Primary>boundsOfArray</Primary></IndexTerm>
-<IndexTerm><Primary>readArray</Primary></IndexTerm>
-<IndexTerm><Primary>writeArray</Primary></IndexTerm>
-<IndexTerm><Primary>freezeArray</Primary></IndexTerm>
-<IndexTerm><Primary>thawArray</Primary></IndexTerm>
-<IndexTerm><Primary>unsafeFreezeArray</Primary></IndexTerm>
-<IndexTerm><Primary>unsafeThawArray</Primary></IndexTerm>
-</Para>
-
-<Para>
-<Emphasis>Remarks:</Emphasis>
-</Para>
-
-<Para>
-
-<ItemizedList>
-<ListItem>
-
-<Para>
-The <Function>freezeArray</Function> action converts a mutable array into an
-immutable one by copying, whereas <Function>unsafeFreezeArray</Function> returns
-an immutable array that is effectively just the type cast version
-of the mutable array. Should you write to the mutable array after
-it has been (unsafely) frozen, you'll side-effect the immutable
-array in the process. Please don't :-)
-
-</Para>
-</ListItem>
-<ListItem>
-
-<Para>
-The operation <Function>thawArray</Function> goes the other way, converting
-an immutable <Literal>Array</Literal> into a mutable one. This is done by
-copying. The operation <Function>unsafeThawArray</Function> is also provided,
-which places the same kind of proof obligation on the programmer
-as <Function>unsafeFreezeArray</Function> does.
-</Para>
-</ListItem>
-
-</ItemizedList>
-
-</Para>
-
-</Sect3>
-
-<Sect3 id="MutableArray-mutable-byte-arrays">
-<Title>Mutable byte arrays
-<IndexTerm><Primary>Mutable byte arrays</Primary></IndexTerm>
-</Title>
-
-<Para>
-<ProgramListing>
--- creators:
-newCharArray      :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-newAddrArray      :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-newIntArray       :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-newWordArray      :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-newFloatArray     :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-newDoubleArray    :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-newStablePtrArray :: Ix ix =&#62; (ix,ix) -&#62; ST s (MutableByteArray s ix)
-
-boundsOfMutableByteArray
-                   :: Ix ix =&#62; MutableByteArray s ix -&#62; (ix, ix)
-
-readCharArray      :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Char
-readIntArray       :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Int
-readAddrArray      :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Addr
-readFloatArray     :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Float
-readDoubleArray    :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Double
-readStablePtrArray :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s (StablePtr a)
-readWord8Array    :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Word8
-readWord16Array           :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Word16
-readWord32Array           :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Word32
-readWord64Array           :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Word64
-readInt8Array     :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Int8
-readInt16Array    :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Int16
-readInt32Array    :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Int32
-readInt64Array    :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; ST s Int64
-
-writeCharArray        :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Char -&#62; ST s ()
-writeIntArray         :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Int  -&#62; ST s ()
-writeAddrArray        :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Addr -&#62; ST s ()
-writeFloatArray       :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Float -&#62; ST s ()
-writeDoubleArray      :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Double -&#62; ST s ()
-writeStablePtrArray   :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; StablePtr a -&#62; ST s ()
-writeWord8Array              :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Word8  -&#62; ST s ()
-writeWord16Array      :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Word16 -&#62; ST s ()
-writeWord32Array      :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Word32 -&#62; ST s ()
-writeWord64Array      :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Word64 -&#62; ST s ()
-writeInt8Array       :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Int8  -&#62; ST s ()
-writeInt16Array       :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Int16 -&#62; ST s ()
-writeInt32Array              :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Int32 -&#62; ST s ()
-writeInt64Array              :: Ix ix =&#62; MutableByteArray s ix -&#62; ix -&#62; Int64 -&#62; ST s ()
-
-freezeCharArray       :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-freezeIntArray        :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-freezeAddrArray       :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-freezeFloatArray      :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-freezeDoubleArray     :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-freezeStablePtrArray  :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-
-unsafeFreezeByteArray  :: Ix ix =&#62; MutableByteArray s ix -&#62; ST s (ByteArray ix)
-
-sizeofMutableByteArray :: Ix ix =&#62; MutableByteArray s ix -&#62; Int
-
-thawByteArray       :: Ix ix =&#62; ByteArray ixt -&#62; ST s (MutableByteArray s ix)
-unsafeThawByteArray :: Ix ix =&#62; ByteArray ixt -&#62; ST s (MutableByteArray s ix)
-</ProgramListing>
-
-<IndexTerm><Primary>newCharArray</Primary></IndexTerm>
-<IndexTerm><Primary>newAddrArray</Primary></IndexTerm>
-<IndexTerm><Primary>newIntArray</Primary></IndexTerm>
-<IndexTerm><Primary>newFloatArray</Primary></IndexTerm>
-<IndexTerm><Primary>newDoubleArray</Primary></IndexTerm>
-<IndexTerm><Primary>boundsOfMutableByteArray</Primary></IndexTerm>
-<IndexTerm><Primary>readCharArray</Primary></IndexTerm>
-<IndexTerm><Primary>readIntArray</Primary></IndexTerm>
-<IndexTerm><Primary>readAddrArray</Primary></IndexTerm>
-<IndexTerm><Primary>readFloatArray</Primary></IndexTerm>
-<IndexTerm><Primary>readDoubleArray</Primary></IndexTerm>
-<IndexTerm><Primary>readWord8Array</Primary></IndexTerm>
-<IndexTerm><Primary>readWord16Array</Primary></IndexTerm>
-<IndexTerm><Primary>readWord32Array</Primary></IndexTerm>
-<IndexTerm><Primary>readWord64Array</Primary></IndexTerm>
-<IndexTerm><Primary>readInt8Array</Primary></IndexTerm>
-<IndexTerm><Primary>readInt16Array</Primary></IndexTerm>
-<IndexTerm><Primary>readInt32Array</Primary></IndexTerm>
-<IndexTerm><Primary>readInt64Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeCharArray</Primary></IndexTerm>
-<IndexTerm><Primary>writeIntArray</Primary></IndexTerm>
-<IndexTerm><Primary>writeAddrArray</Primary></IndexTerm>
-<IndexTerm><Primary>writeFloatArray</Primary></IndexTerm>
-<IndexTerm><Primary>writeDoubleArray</Primary></IndexTerm>
-<IndexTerm><Primary>writeWord8Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeWord16Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeWord32Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeWord64Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeInt8Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeInt16Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeInt32Array</Primary></IndexTerm>
-<IndexTerm><Primary>writeInt64Array</Primary></IndexTerm>
-<IndexTerm><Primary>freezeCharArray</Primary></IndexTerm>
-<IndexTerm><Primary>freezeIntArray</Primary></IndexTerm>
-<IndexTerm><Primary>freezeAddrArray</Primary></IndexTerm>
-<IndexTerm><Primary>freezeFloatArray</Primary></IndexTerm>
-<IndexTerm><Primary>freezeDoubleArray</Primary></IndexTerm>
-<IndexTerm><Primary>unsafeFreezeByteArray</Primary></IndexTerm>
-<IndexTerm><Primary>unsafeThawByteArray</Primary></IndexTerm>
-<IndexTerm><Primary>thawByteArray</Primary></IndexTerm>
-</Para>
-
-<Para>
-<Emphasis>Remarks:</Emphasis>
-
-<ItemizedList>
-<ListItem>
-
-<Para>
-A Mutable byte array is created by specifying its size in units of
-some basic type. For example,
-
-
-<ProgramListing>
-mkPair :: ST s (MutableByteArray s Int)
-mkPair = newIntArray (0,1)
-</ProgramListing>
-
-
-creates a mutable array capable of storing two <Literal>Int</Literal>s. Notice
-that the range size <Emphasis>is not in bytes</Emphasis>, but in units of the
-basic type.
-
-</Para>
-</ListItem>
-<ListItem>
-
-<Para>
-A mutable byte array is not parameterised over the kind of values
-it contains. A consequence of this is that it is possible to
-have byte arrays containing a mix of basic types, or even read
-a value from the array at a different type from which it was
-written, e.g.,
-
-<ProgramListing>
-isLitteEndian :: IO Bool
-isLitteEndian = stToIO $ do
-   x &#60;- newIntArray (0,1)
-   writeIntArray x 1
-   v &#60;- readCharArray x 0
-   return (v == chr 1)
-</ProgramListing>
-
-
-It's left as an exercise for the reader to determine whether having
-byte arrays not be parameterised over the type of values they
-contain is a bug or a feature..
-
-</Para>
-</ListItem>
-<ListItem>
-<Para>
-As for mutable arrays, operations for turning mutable byte arrays
-into immutable byte arrays are also provided by the <Function>freeze*</Function>
-class of actions. There's also the non-copying
-<Function>unsafeFreezeByteArray</Function>.
-</Para>
-</ListItem>
-<ListItem>
-
-<Para>
-Operations for going the other way, where an immutable byte
-array is 'thawed' are also provided. <Function>thawByteArray</Function> does
-this by copying, whereas <Function>unsafeThawByteArray</Function> does not
-
-</Para>
-</ListItem>
-<ListItem>
-
-<Para>
-The operation <Function>sizeofMutableByteArray</Function> returns the size of
-the array, <Emphasis>in bytes.</Emphasis>
-</Para>
-</ListItem>
-
-</ItemizedList>
-
-</Para>
-
-</Sect3>
-
-</Sect2>
diff --git a/ghc/docs/users_guide/libmisc.sgml b/ghc/docs/users_guide/libmisc.sgml
deleted file mode 100644 (file)
index ba928bd..0000000
+++ /dev/null
@@ -1,1046 +0,0 @@
-<Sect1 id="GHC-library">
-<Title>Miscellaneous libraries
-</Title>
-
-<Para>
-<IndexTerm><Primary>libraries, miscellaneous</Primary></IndexTerm>
-<IndexTerm><Primary>misc, syslib</Primary></IndexTerm>
-</Para>
-
-<Para>
-This section describes a collection of Haskell libraries we've
-collected over the years.  Access to any of these modules is provided
-by giving the <Option>-syslib misc</Option><IndexTerm><Primary>-syslib misc option</Primary></IndexTerm>.
-</Para>
-
-<Sect2 id="Bag">
-<Title>The <Literal>Bag</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>Bag module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-A <Emphasis>bag</Emphasis> is an unordered collection of elements which may contain
-duplicates.  To use, <Literal>import Bag</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data Bag elt    -- abstract
-
-emptyBag        :: Bag elt
-unitBag         :: elt -&#62; Bag elt
-
-consBag         :: elt       -&#62; Bag elt -&#62; Bag elt
-snocBag         :: Bag elt   -&#62; elt     -&#62; Bag elt
-
-unionBags       :: Bag elt   -&#62; Bag elt -&#62; Bag elt
-unionManyBags   :: [Bag elt] -&#62; Bag elt
-
-isEmptyBag      :: Bag elt   -&#62; Bool
-elemBag         :: Eq elt =&#62; elt -&#62; Bag elt -&#62; Bool
-
-filterBag       :: (elt -&#62; Bool) -&#62; Bag elt -&#62; Bag elt
-partitionBag    :: (elt -&#62; Bool) -&#62; Bag elt-&#62; (Bag elt, Bag elt)
-        -- returns the elements that do/don't satisfy the predicate
-
-concatBag       :: Bag (Bag a) -&#62; Bag a
-foldBag         :: (r -&#62; r -&#62; r) -&#62; (a -&#62; r) -&#62; r -&#62; Bag a -&#62; r
-mapBag          :: (a -&#62; b) -&#62; Bag a -&#62; Bag b
-
-listToBag       :: [elt] -&#62; Bag elt
-bagToList       :: Bag elt -&#62; [elt]
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="FiniteMap">
-<Title>The <Literal>FiniteMap</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>FiniteMap module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-What functional programmers call a <Emphasis>finite map</Emphasis>, everyone else
-calls a <Emphasis>lookup table</Emphasis>.
-</Para>
-
-<Para>
-Out code is derived from that in this paper:
-<QUOTE
->S Adams
-"Efficient sets: a balancing act"
-Journal of functional programming 3(4) Oct 1993, pages 553-562</QUOTE
->
-Guess what?  The implementation uses balanced trees.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data FiniteMap key elt  -- abstract
-
---      BUILDING
-emptyFM         :: FiniteMap key elt
-unitFM          :: key -&#62; elt -&#62; FiniteMap key elt
-listToFM        :: Ord key =&#62; [(key,elt)] -&#62; FiniteMap key elt
-                        -- In the case of duplicates, the last is taken
-
---      ADDING AND DELETING
-                   -- Throws away any previous binding
-                   -- In the list case, the items are added starting with the
-                   -- first one in the list
-addToFM         :: Ord key =&#62; FiniteMap key elt -&#62; key -&#62; elt  -&#62; FiniteMap key elt
-addListToFM     :: Ord key =&#62; FiniteMap key elt -&#62; [(key,elt)] -&#62; FiniteMap key elt
-
-                 -- Combines with previous binding
-                 -- In the combining function, the first argument is
-                 -- the "old" element, while the second is the "new" one.
-addToFM_C       :: Ord key =&#62; (elt -&#62; elt -&#62; elt)
-                           -&#62; FiniteMap key elt -&#62; key -&#62; elt
-                           -&#62; FiniteMap key elt
-addListToFM_C   :: Ord key =&#62; (elt -&#62; elt -&#62; elt)
-                           -&#62; FiniteMap key elt -&#62; [(key,elt)]
-                           -&#62; FiniteMap key elt
-
-                 -- Deletion doesn't complain if you try to delete something
-                 -- which isn't there
-delFromFM       :: Ord key =&#62; FiniteMap key elt -&#62; key   -&#62; FiniteMap key elt
-delListFromFM   :: Ord key =&#62; FiniteMap key elt -&#62; [key] -&#62; FiniteMap key elt
-
---      COMBINING
-                 -- Bindings in right argument shadow those in the left
-plusFM          :: Ord key =&#62; FiniteMap key elt -&#62; FiniteMap key elt
-                           -&#62; FiniteMap key elt
-
-                   -- Combines bindings for the same thing with the given function
-plusFM_C        :: Ord key =&#62; (elt -&#62; elt -&#62; elt)
-                           -&#62; FiniteMap key elt -&#62; FiniteMap key elt -&#62; FiniteMap key elt
-
-minusFM         :: Ord key =&#62; FiniteMap key elt -&#62; FiniteMap key elt -&#62; FiniteMap key elt
-                   -- (minusFM a1 a2) deletes from a1 any bindings which are bound in a2
-
-intersectFM     :: Ord key =&#62; FiniteMap key elt -&#62; FiniteMap key elt -&#62; FiniteMap key elt
-intersectFM_C   :: Ord key =&#62; (elt -&#62; elt -&#62; elt)
-                           -&#62; FiniteMap key elt -&#62; FiniteMap key elt -&#62; FiniteMap key elt
-
---      MAPPING, FOLDING, FILTERING
-foldFM          :: (key -&#62; elt -&#62; a -&#62; a) -&#62; a -&#62; FiniteMap key elt -&#62; a
-mapFM           :: (key -&#62; elt1 -&#62; elt2) -&#62; FiniteMap key elt1 -&#62; FiniteMap key elt2
-filterFM        :: Ord key =&#62; (key -&#62; elt -&#62; Bool)
-                           -&#62; FiniteMap key elt -&#62; FiniteMap key elt
-
---      INTERROGATING
-sizeFM          :: FiniteMap key elt -&#62; Int
-isEmptyFM       :: FiniteMap key elt -&#62; Bool
-
-elemFM          :: Ord key =&#62; key -&#62; FiniteMap key elt -&#62; Bool
-lookupFM        :: Ord key =&#62; FiniteMap key elt -&#62; key -&#62; Maybe elt
-lookupWithDefaultFM
-                :: Ord key =&#62; FiniteMap key elt -&#62; elt -&#62; key -&#62; elt
-                -- lookupWithDefaultFM supplies a "default" elt
-                -- to return for an unmapped key
-
---      LISTIFYING
-fmToList        :: FiniteMap key elt -&#62; [(key,elt)]
-keysFM          :: FiniteMap key elt -&#62; [key]
-eltsFM          :: FiniteMap key elt -&#62; [elt]
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="ListSetOps">
-<Title>The <Literal>ListSetOps</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>ListSetOps module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-Just a few set-sounding operations on lists.  If you want sets, use
-the <Literal>Set</Literal> module.
-</Para>
-
-<Para>
-
-<ProgramListing>
-unionLists          :: Eq a =&#62; [a] -&#62; [a] -&#62; [a]
-intersectLists      :: Eq a =&#62; [a] -&#62; [a] -&#62; [a]
-minusList           :: Eq a =&#62; [a] -&#62; [a] -&#62; [a]
-disjointLists       :: Eq a =&#62; [a] -&#62; [a] -&#62; Bool
-intersectingLists   :: Eq a =&#62; [a] -&#62; [a] -&#62; Bool
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="Maybes">
-<Title>The <Literal>Maybes</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>Maybes module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-The <Literal>Maybe</Literal> type is in the Haskell 1.4 prelude. Moreover, the
-required <Literal>Maybe</Literal> library provides many useful functions on
-<Literal>Maybe</Literal>s. This (pre-1.3) module provides some more:
-</Para>
-
-<Para>
-An <Literal>Either</Literal>-like type called <Literal>MaybeErr</Literal>:
-
-<ProgramListing>
-data MaybeErr val err = Succeeded val | Failed err
-</ProgramListing>
-
-</Para>
-
-<Para>
-Some operations to do with <Literal>Maybe</Literal> (some commentary follows):
-
-<ProgramListing>
-maybeToBool :: Maybe a -&#62; Bool      -- Nothing =&#62; False; Just =&#62; True
-allMaybes   :: [Maybe a] -&#62; Maybe [a]
-firstJust   :: [Maybe a] -&#62; Maybe a
-findJust    :: (a -&#62; Maybe b) -&#62; [a] -&#62; Maybe b
-
-assocMaybe  :: Eq a =&#62; [(a,b)] -&#62; a -&#62; Maybe b
-mkLookupFun :: (key -&#62; key -&#62; Bool) -- Equality predicate
-            -&#62; [(key,val)]          -- The assoc list
-            -&#62; (key -&#62; Maybe val)   -- A lookup fun to use
-mkLookupFunDef :: (key -&#62; key -&#62; Bool)  -- Equality predicate
-               -&#62; [(key,val)]           -- The assoc list
-               -&#62; val                   -- Value to return on failure
-               -&#62; key                   -- The key
-               -&#62; val                   -- The corresponding value
-
-    -- a monad thing
-thenMaybe   :: Maybe a -&#62; (a -&#62; Maybe b) -&#62; Maybe b
-returnMaybe :: a -&#62; Maybe a
-failMaybe   :: Maybe a
-mapMaybe    :: (a -&#62; Maybe b) -&#62; [a] -&#62; Maybe [b]
-</ProgramListing>
-
-</Para>
-
-<Para>
-NB: <Function>catMaybes</Function> which used to be here, is now available via the
-standard <Literal>Maybe</Literal> interface (<Literal>Maybe</Literal> is an instance of <Literal>MonadPlus</Literal>).
-</Para>
-
-<Para>
-<Function>allMaybes</Function> collects a list of <Literal>Justs</Literal> into a single <Literal>Just</Literal>, returning
-<Literal>Nothing</Literal> if there are any <Literal>Nothings</Literal>.
-</Para>
-
-<Para>
-<Function>firstJust</Function> takes a list of <Literal>Maybes</Literal> and returns the
-first <Literal>Just</Literal> if there is one, or <Literal>Nothing</Literal> otherwise.
-</Para>
-
-<Para>
-<Function>assocMaybe</Function> looks up in an association list, returning
-<Literal>Nothing</Literal> if it fails.
-</Para>
-
-<Para>
-Now, some operations to do with <Literal>MaybeErr</Literal> (comments follow):
-
-<ProgramListing>
-    -- a monad thing (surprise, surprise)
-thenMaB   :: MaybeErr a err -&#62; (a -&#62; MaybeErr b err) -&#62; MaybeErr b err
-returnMaB :: val -&#62; MaybeErr val err
-failMaB   :: err -&#62; MaybeErr val err
-
-listMaybeErrs :: [MaybeErr val err] -&#62; MaybeErr [val] [err]
-foldlMaybeErrs :: (acc -&#62; input -&#62; MaybeErr acc err)
-               -&#62; acc
-               -&#62; [input]
-               -&#62; MaybeErr acc [err]
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>listMaybeErrs</Function> takes a list of <Literal>MaybeErrs</Literal> and, if they all succeed,
-returns a <Literal>Succeeded</Literal> of a list of their values.  If any fail, it
-returns a <Literal>Failed</Literal> of the list of all the errors in the list.
-</Para>
-
-<Para>
-<Function>foldlMaybeErrs</Function> works along a list, carrying an accumulator; it
-applies the given function to the accumulator and the next list item,
-accumulating any errors that occur.
-</Para>
-
-</Sect2>
-
-<Sect2 id="memo-library">
-<Title>The <Literal>Memo</Literal> library
-</Title>
-
-<Para>
-<IndexTerm><Primary>Memo (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-The <Literal>Memo</Literal> library provides fast polymorphic memo functions using hash
-tables.  The interface is:
-</Para>
-
-<Para>
-
-<ProgramListing>
-memo :: (a -&#62; b) -&#62; a -&#62; b
-</ProgramListing>
-
-</Para>
-
-<Para>
-So, for example, <Function>memo f</Function> is a version of <Function>f</Function> that caches the results
-of previous calls.
-</Para>
-
-<Para>
-The searching is very fast, being based on pointer equality.  One
-consequence of this is that the caching will only be effective if
-<Emphasis>exactly the same argument is passed again to the memoised
-function</Emphasis>.  This means not just a copy of a previous argument, but the
-same instance.  It's not useful to memoise integer functions using
-this interface, because integers are generally copied a lot and two
-instances of '27' are unlikely to refer to the same object.
-</Para>
-
-<Para>
-This memoisation library works well when the keys are large (or even
-infinite).
-</Para>
-
-<Para>
-The memo table implementation uses weak pointers and stable names (see
-the GHC/Hugs library document) to avoid space leaks and allow hashing
-for arbitrary Haskell objects.  NOTE: while individual memo table
-entries will be garbage collected if the associated key becomes
-garbage, the memo table itself will not be collected if the function
-becomes garbage.  We plan to fix this in a future version.
-</Para>
-
-<Para>
-There's another version of <Function>memo</Function> if you want to explicitly give a
-size for the hash table (the default size is 1001 buckets):
-</Para>
-
-<Para>
-
-<ProgramListing>
-memo_sized :: Int -&#62; (a -&#62; b) -&#62; a -&#62; b
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="PackedString">
-<Title>The <Literal>PackedString</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>PackedString module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-You need to <Literal>import PackedString</Literal> and heave in your
-<Option>-syslib ghc</Option> to use <Literal>PackedString</Literal>s.
-</Para>
-
-<Para>
-The basic type and functions available are:
-
-<ProgramListing>
-data PackedString -- abstract
-
-packString          :: [Char] -&#62; PackedString
-packStringST        :: [Char] -&#62; ST s PackedString
-packCBytesST        :: Int -&#62; Addr -&#62; ST s PackedString
-packBytesForCST     :: [Char] -&#62; ST s (ByteArray Int)
-byteArrayToPS       :: ByteArray Int -&#62; PackedString
-unsafeByteArrayToPS :: ByteArray a   -&#62; Int -&#62; PackedString
-psToByteArray       :: PackedString -&#62; ByteArray Int
-psToByteArrayST     :: PackedString -&#62; ST s (ByteArray Int)
-
-unpackPS        :: PackedString -&#62; [Char]
-</ProgramListing>
-
-</Para>
-
-<Para>
-We also provide a wad of list-manipulation-like functions:
-
-<ProgramListing>
-nilPS       :: PackedString
-consPS      :: Char -&#62; PackedString -&#62; PackedString
-
-headPS      :: PackedString -&#62; Char
-tailPS      :: PackedString -&#62; PackedString
-nullPS      :: PackedString -&#62; Bool
-appendPS    :: PackedString -&#62; PackedString -&#62; PackedString
-lengthPS    :: PackedString -&#62; Int
-indexPS     :: PackedString -&#62; Int -&#62; Char
-            -- 0-origin indexing into the string
-mapPS       :: (Char -&#62; Char) -&#62; PackedString -&#62; PackedString
-filterPS    :: (Char -&#62; Bool) -&#62; PackedString -&#62; PackedString
-foldlPS     :: (a -&#62; Char -&#62; a) -&#62; a -&#62; PackedString -&#62; a
-foldrPS     :: (Char -&#62; a -&#62; a) -&#62; a -&#62; PackedString -&#62; a
-takePS      :: Int -&#62; PackedString -&#62; PackedString
-dropPS      :: Int -&#62; PackedString -&#62; PackedString
-splitAtPS   :: Int -&#62; PackedString -&#62; (PackedString, PackedString)
-takeWhilePS :: (Char -&#62; Bool) -&#62; PackedString -&#62; PackedString
-dropWhilePS :: (Char -&#62; Bool) -&#62; PackedString -&#62; PackedString
-spanPS      :: (Char -&#62; Bool) -&#62; PackedString -&#62; (PackedString, PackedString)
-breakPS     :: (Char -&#62; Bool) -&#62; PackedString -&#62; (PackedString, PackedString)
-linesPS     :: PackedString -&#62; [PackedString]
-wordsPS     :: PackedString -&#62; [PackedString]
-reversePS   :: PackedString -&#62; PackedString
-concatPS    :: [PackedString] -&#62; PackedString
-elemPS      :: Char -&#62; PackedString -&#62; Bool
-  -- Perl-style split&amp;join
-splitPS     :: Char -&#62; PackedString -&#62; [PackedString]
-splitWithPS :: (Char -&#62; Bool) -&#62; PackedString -&#62; [PackedString]
-joinPS      :: PackedString -&#62; [PackedString] -&#62; PackedString
-
-substrPS   :: PackedString -&#62; Int -&#62; Int -&#62; PackedString
-           -- pluck out a piece of a PackedString
-           -- start and end chars you want; both 0-origin-specified
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="Set">
-<Title>The <Literal>Set</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>Set module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-Our implementation of <Emphasis>sets</Emphasis> (key property: no duplicates) is just
-a variant of the <Literal>FiniteMap</Literal> module.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data Set        -- abstract
-                -- instance of: Eq
-
-emptySet        :: Set a
-mkSet           :: Ord a =&#62; [a]  -&#62; Set a
-setToList       :: Set a -&#62; [a]
-unitSet         :: a -&#62; Set a
-singletonSet    :: a -&#62; Set a  -- deprecated, use unitSet.
-
-union           :: Ord a =&#62; Set a -&#62; Set a -&#62; Set a
-unionManySets   :: Ord a =&#62; [Set a] -&#62; Set a
-minusSet        :: Ord a =&#62; Set a -&#62; Set a -&#62; Set a
-mapSet          :: Ord a =&#62; (b -&#62; a) -&#62; Set b -&#62; Set a
-intersect       :: Ord a =&#62; Set a -&#62; Set a -&#62; Set a
-
-elementOf       :: Ord a =&#62; a -&#62; Set a -&#62; Bool
-isEmptySet      :: Set a -&#62; Bool
-
-cardinality     :: Set a -&#62; Int
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="BitSet">
-<Title>The <Literal>BitSet</Literal> interface
-</Title>
-
-<Para>
-<IndexTerm><Primary>Bitset interface (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-Bit sets are a fast implementation of sets of integers ranging from 0
-to one less than the number of bits in a machine word (typically 31).
-If any element exceeds the maximum value for a particular machine
-architecture, the results of these operations are undefined.  You have
-been warned.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data BitSet   -- abstract
-              -- instance of:
-
-emptyBS       :: BitSet
-mkBS          :: [Int] -&#62; BitSet
-unitBS        :: Int -&#62; BitSet
-unionBS       :: BitSet -&#62; BitSet -&#62; BitSet
-minusBS       :: BitSet -&#62; BitSet -&#62; BitSet
-isEmptyBS     :: BitSet -&#62; Bool
-intersectBS   :: BitSet -&#62; BitSet -&#62; BitSet
-elementBS     :: Int -&#62; BitSet -&#62; Bool
-listBS        :: BitSet -&#62; [Int]
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="Util">
-<Title>The <Literal>Util</Literal> type
-</Title>
-
-<Para>
-<IndexTerm><Primary>Util module (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-Stuff that has been generally useful to use in writing the compiler.
-Don't be too surprised if this stuff moves/gets-renamed/etc.
-</Para>
-
-<Para>
-
-<ProgramListing>
--- general list processing
-forall          :: (a -&#62; Bool) -&#62; [a] -&#62; Bool
-exists          :: (a -&#62; Bool) -&#62; [a] -&#62; Bool
-
-nOfThem         :: Int -&#62; a -&#62; [a]
-lengthExceeds   :: [a] -&#62; Int -&#62; Bool
-isSingleton     :: [a] -&#62; Bool
-
---paranoid zip'ing (equal length lists)
-zipEqual        :: [a] -&#62; [b] -&#62; [(a,b)]
-zipWithEqual    :: String -&#62; (a-&#62;b-&#62;c) -&#62; [a]-&#62;[b]-&#62;[c]
-zipWith3Equal   :: String -&#62; (a-&#62;b-&#62;c-&#62;d) -&#62; [a]-&#62;[b]-&#62;[c]-&#62;[d]
-zipWith4Equal   :: String -&#62; (a-&#62;b-&#62;c-&#62;d-&#62;e) -&#62; [a]-&#62;[b]-&#62;[c]-&#62;[d]-&#62;[e]
--- lazy in second argument
-zipLazy :: [a] -&#62; [b] -&#62; [(a,b)]
-
-mapAndUnzip :: (a -&#62; (b, c)) -&#62; [a] -&#62; ([b], [c])
-mapAndUnzip3 :: (a -&#62; (b, c, d)) -&#62; [a] -&#62; ([b], [c], [d])
-
--- prefix and suffix matching on lists of characters.
-startsWith :: {-prefix-}String -&#62; String -&#62; Maybe String
-endsWith   :: {-suffix-}String -&#62; String -&#62; Maybe String
-
--- association lists
-assoc       :: Eq a =&#62; String -&#62; [(a, b)] -&#62; a -&#62; b
-
--- duplicate handling
-hasNoDups    :: Eq a =&#62; [a] -&#62; Bool
-equivClasses :: (a -&#62; a -&#62; Ordering) -&#62; [a] -&#62; [[a]]
-runs         :: (a -&#62; a -&#62; Bool)     -&#62; [a] -&#62; [[a]]
-removeDups   :: (a -&#62; a -&#62; Ordering) -&#62; [a] -&#62; ([a], [[a]])
-
--- sorting (don't complain of no choice...)
-quicksort          :: (a -&#62; a -&#62; Bool)     -&#62; [a] -&#62; [a]
-sortLt             :: (a -&#62; a -&#62; Bool)     -&#62; [a] -&#62; [a]
-stableSortLt       :: (a -&#62; a -&#62; Bool)     -&#62; [a] -&#62; [a]
-mergesort          :: (a -&#62; a -&#62; _CMP_TAG) -&#62; [a] -&#62; [a]
-mergeSort          :: Ord a =&#62; [a] -&#62; [a]
-naturalMergeSort   :: Ord a =&#62; [a] -&#62; [a]
-mergeSortLe        :: Ord a =&#62; [a] -&#62; [a]
-naturalMergeSortLe :: Ord a =&#62; [a] -&#62; [a]
-
--- transitive closures
-transitiveClosure :: (a -&#62; [a])         -- Successor function
-                  -&#62; (a -&#62; a -&#62; Bool)   -- Equality predicate
-                  -&#62; [a]
-                  -&#62; [a]                -- The transitive closure
-
--- accumulating (Left, Right, Bi-directional)
-mapAccumL :: (acc -&#62; x -&#62; (acc, y))
-                        -- Function of elt of input list and
-                        -- accumulator, returning new accumulator and
-                        -- elt of result list
-          -&#62; acc        -- Initial accumulator
-          -&#62; [x]        -- Input list
-          -&#62; (acc, [y]) -- Final accumulator and result list
-
-mapAccumR :: (acc -&#62; x -&#62; (acc, y)) -&#62; acc -&#62; [x] -&#62; (acc, [y])
-
-mapAccumB :: (accl -&#62; accr -&#62; x -&#62; (accl, accr,y))
-          -&#62; accl -&#62; accr -&#62; [x]
-          -&#62; (accl, accr, [y])
-
---list comparison with explicit element comparer.
-cmpList :: (a -&#62; a -&#62; Ordering) -&#62; [a] -&#62; [a] -&#62; Ordering
-
--- pairs
-applyToPair :: ((a -&#62; c), (b -&#62; d)) -&#62; (a, b) -&#62; (c, d)
-applyToFst  :: (a -&#62; c) -&#62; (a, b) -&#62; (c, b)
-applyToSnd  :: (b -&#62; d) -&#62; (a, b) -&#62; (a, d)
-foldPair    :: (a-&#62;a-&#62;a, b-&#62;b-&#62;b) -&#62; (a, b) -&#62; [(a, b)] -&#62; (a, b)
-unzipWith   :: (a -&#62; b -&#62; c) -&#62; [(a, b)] -&#62; [c]
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-</Sect1>
-
-<Sect1 id="C-interfaces">
-<Title>Interfaces to C libraries
-</Title>
-
-<Para>
-<IndexTerm><Primary>C library interfaces</Primary></IndexTerm>
-<IndexTerm><Primary>interfaces, C library</Primary></IndexTerm>
-</Para>
-
-<Para>
-The GHC system library (<Option>-syslib misc</Option>) also provides interfaces to
-several useful C libraries, mostly from the GNU project.
-</Para>
-
-<Sect2 id="Readline">
-<Title>The <Literal>Readline</Literal> interface
-</Title>
-
-<Para>
-<IndexTerm><Primary>Readline library (misc syslib)</Primary></IndexTerm>
-<IndexTerm><Primary>command-line editing library</Primary></IndexTerm>
-</Para>
-
-<Para>
-(Darren Moffat supplied the <Literal>Readline</Literal> interface.)
-</Para>
-
-<Para>
-The <Literal>Readline</Literal> module is a straightforward interface to the GNU
-Readline library.  As such, you will need to look at the GNU
-documentation (and have a <Filename>libreadline.a</Filename> file around somewhere&hellip;)
-</Para>
-
-<Para>
-You'll need to link any Readlining program with <Option>-lreadline -ltermcap</Option>,
-besides the usual <Option>-syslib ghc</Option> (and <Option>-fhaskell-1.3</Option>).
-</Para>
-
-<Para>
-The main function you'll use is:
-
-<ProgramListing>
-readline :: String{-the prompt-} -&#62; IO String
-</ProgramListing>
-
-</Para>
-
-<Para>
-If you want to mess around with Full Readline G(l)ory, we also
-provide:
-
-<ProgramListing>
-rlInitialize, addHistory,
-
-rlBindKey, rlAddDefun, RlCallbackFunction(..),
-
-rlGetLineBuffer, rlSetLineBuffer, rlGetPoint, rlSetPoint, rlGetEnd,
-rlSetEnd, rlGetMark, rlSetMark, rlSetDone, rlPendingInput,
-
-rlPrompt, rlTerminalName, rlSetReadlineName, rlGetReadlineName
-</ProgramListing>
-
-(All those names are just Haskellised versions of what you
-will see in the GNU readline documentation.)
-</Para>
-
-</Sect2>
-
-<Sect2 id="Regex">
-<Title>The <Literal>Regex</Literal> and <Literal>MatchPS</Literal> interfaces
-</Title>
-
-<Para>
-<IndexTerm><Primary>Regex library (misc syslib)</Primary></IndexTerm>
-<IndexTerm><Primary>MatchPS library (misc syslib)</Primary></IndexTerm>
-<IndexTerm><Primary>regular-expressions library</Primary></IndexTerm>
-</Para>
-
-<Para>
-(Sigbjorn Finne supplied the regular-expressions interface.)
-</Para>
-
-<Para>
-The <Literal>Regex</Literal> library provides quite direct interface to the GNU
-regular-expression library, for doing manipulation on <Literal>PackedString</Literal>s.
-You probably need to see the GNU documentation if you are operating at
-this level.  Alternatively, you can use the simpler and higher-level
-<Literal>RegexString</Literal> interface.
-</Para>
-
-<Para>
-The datatypes and functions that <Literal>Regex</Literal> provides are:
-
-<ProgramListing>
-data PatBuffer  # just a bunch of bytes (mutable)
-
-data REmatch
- = REmatch (Array Int GroupBounds)  -- for $1, ... $n
-           GroupBounds              -- for $` (everything before match)
-           GroupBounds              -- for $&amp; (entire matched string)
-           GroupBounds              -- for $' (everything after)
-           GroupBounds              -- for $+ (matched by last bracket)
-
--- GroupBounds hold the interval where a group
--- matched inside a string, e.g.
---
--- matching "reg(exp)" "a regexp" returns the pair (5,7) for the
--- (exp) group. (PackedString indices start from 0)
-
-type GroupBounds = (Int, Int)
-
-re_compile_pattern
-        :: PackedString         -- pattern to compile
-        -&#62; Bool                 -- True &#60;=&#62; assume single-line mode
-        -&#62; Bool                 -- True &#60;=&#62; case-insensitive
-        -&#62; PrimIO PatBuffer
-
-re_match :: PatBuffer           -- compiled regexp
-         -&#62; PackedString        -- string to match
-         -&#62; Int                 -- start position
-         -&#62; Bool                -- True &#60;=&#62; record results in registers
-         -&#62; PrimIO (Maybe REmatch)
-
--- Matching on 2 strings is useful when you're dealing with multiple
--- buffers, which is something that could prove useful for
--- PackedStrings, as we don't want to stuff the contents of a file
--- into one massive heap chunk, but load (smaller chunks) on demand.
-
-re_match2 :: PatBuffer          -- 2-string version
-          -&#62; PackedString
-          -&#62; PackedString
-          -&#62; Int
-          -&#62; Int
-          -&#62; Bool
-          -&#62; PrimIO (Maybe REmatch)
-
-re_search :: PatBuffer          -- compiled regexp
-          -&#62; PackedString       -- string to search
-          -&#62; Int                -- start index
-          -&#62; Int                -- stop index
-          -&#62; Bool               -- True &#60;=&#62; record results in registers
-          -&#62; PrimIO (Maybe REmatch)
-
-re_search2 :: PatBuffer         -- Double buffer search
-           -&#62; PackedString
-           -&#62; PackedString
-           -&#62; Int               -- start index
-           -&#62; Int               -- range (?)
-           -&#62; Int               -- stop index
-           -&#62; Bool              -- True &#60;=&#62; results in registers
-           -&#62; PrimIO (Maybe REmatch)
-</ProgramListing>
-
-</Para>
-
-<Para>
-The <Literal>MatchPS</Literal> module provides Perl-like ``higher-level'' facilities
-to operate on <Literal>PackedStrings</Literal>.  The regular expressions in
-question are in Perl syntax.  The ``flags'' on various functions can
-include: <Option>i</Option> for case-insensitive, <Option>s</Option> for single-line mode, and
-<Option>g</Option> for global.  (It's probably worth your time to peruse the
-source code&hellip;)
-</Para>
-
-<Para>
-
-<ProgramListing>
-matchPS :: PackedString    -- regexp
-        -&#62; PackedString    -- string to match
-        -&#62; [Char]          -- flags
-        -&#62; Maybe REmatch   -- info about what matched and where
-
-searchPS :: PackedString    -- regexp
-         -&#62; PackedString    -- string to match
-         -&#62; [Char]          -- flags
-         -&#62; Maybe REmatch
-
--- Perl-like match-and-substitute:
-substPS :: PackedString     -- regexp
-        -&#62; PackedString     -- replacement
-        -&#62; [Char]           -- flags
-        -&#62; PackedString     -- string
-        -&#62; PackedString
-
--- same as substPS, but no prefix and suffix:
-replacePS :: PackedString  -- regexp
-          -&#62; PackedString  -- replacement
-          -&#62; [Char]        -- flags
-          -&#62; PackedString  -- string
-          -&#62; PackedString
-
-match2PS :: PackedString   -- regexp
-         -&#62; PackedString   -- string1 to match
-         -&#62; PackedString   -- string2 to match
-         -&#62; [Char]         -- flags
-         -&#62; Maybe REmatch
-
-search2PS :: PackedString  -- regexp
-          -&#62; PackedString  -- string to match
-          -&#62; PackedString  -- string to match
-          -&#62; [Char]        -- flags
-          -&#62; Maybe REmatch
-
--- functions to pull the matched pieces out of an REmatch:
-
-getMatchesNo    :: REmatch -&#62; Int
-getMatchedGroup :: REmatch -&#62; Int -&#62; PackedString -&#62; PackedString
-getWholeMatch   :: REmatch -&#62; PackedString -&#62; PackedString
-getLastMatch    :: REmatch -&#62; PackedString -&#62; PackedString
-getAfterMatch   :: REmatch -&#62; PackedString -&#62; PackedString
-
--- (reverse) brute-force string matching;
--- Perl equivalent is index/rindex:
-findPS, rfindPS :: PackedString -&#62; PackedString -&#62; Maybe Int
-
--- Equivalent to Perl "chop" (off the last character, if any):
-chopPS :: PackedString -&#62; PackedString
-
--- matchPrefixPS: tries to match as much as possible of strA starting
--- from the beginning of strB (handy when matching fancy literals in
--- parsers):
-matchPrefixPS :: PackedString -&#62; PackedString -&#62; Int
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="RegexString">
-<Title>The <Literal>RegexString</Literal> interface
-</Title>
-
-<Para>
-<IndexTerm><Primary>RegexString library (misc syslib)</Primary></IndexTerm>
-<IndexTerm><Primary>regular-expressions library</Primary></IndexTerm>
-</Para>
-
-<Para>
-(Simon Marlow supplied the String Regex wrapper.)
-</Para>
-
-<Para>
-For simple regular expression operations, the <Literal>Regex</Literal> library is a
-little heavyweight.  <Literal>RegexString</Literal> permits regex matching on ordinary
-Haskell <Literal>String</Literal>s.
-</Para>
-
-<Para>
-The datatypes and functions that <Literal>RegexString</Literal> provides are:
-
-<ProgramListing>
-data Regex              -- a compiled regular expression
-
-mkRegex
-        :: String       -- regexp to compile
-        -&#62; Regex        -- compiled regexp
-
-matchRegex
-        :: Regex        -- compiled regexp
-        -&#62; String       -- string to match
-        -&#62; Maybe [String] -- text of $1, $2, ... (if matched)
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="Socket">
-<Title>Network-interface toolkit&mdash;<Literal>Socket</Literal> and <Literal>SocketPrim</Literal>
-</Title>
-
-<Para>
-<IndexTerm><Primary>SocketPrim interface (misc syslib)</Primary></IndexTerm>
-<IndexTerm><Primary>Socket interface (misc syslib)</Primary></IndexTerm>
-<IndexTerm><Primary>network-interface library</Primary></IndexTerm>
-<IndexTerm><Primary>sockets library</Primary></IndexTerm>
-<IndexTerm><Primary>BSD sockets library</Primary></IndexTerm>
-(Darren Moffat supplied the initial version of this library.)
-</Para>
-
-<Para>
-Your best bet for documentation is to look at the code&mdash;really!&mdash;
-normally in
-<Filename>fptools/ghc/lib/misc/&lcub;BSD,Socket,SocketPrim</Filename>.lhs&rcub;.
-</Para>
-
-<Para>
-The <Literal>BSD</Literal> module provides functions to get at
-system-database info; pretty straightforward if you're into this sort of
-thing:
-
-<ProgramListing>
-getHostName         :: IO String
-
-getServiceByName    :: ServiceName -&#62; IO ServiceEntry
-getServicePortNumber:: ServiceName -&#62; IO PortNumber
-getServiceEntry     :: IO ServiceEntry
-setServiceEntry     :: Bool -&#62; IO ()
-endServiceEntry     :: IO ()
-
-getProtocolByName   :: ProtocolName -&#62; IO ProtocolEntry
-getProtocolByNumber :: ProtocolNumber -&#62; IO ProtcolEntry
-getProtocolNumber   :: ProtocolName -&#62; ProtocolNumber
-getProtocolEntry    :: IO ProtocolEntry
-setProtocolEntry    :: Bool -&#62; IO ()
-endProtocolEntry    :: IO ()
-
-getHostByName       :: HostName -&#62; IO HostEntry
-getHostByAddr       :: Family -&#62; HostAddress -&#62; IO HostEntry
-getHostEntry        :: IO HostEntry
-setHostEntry        :: Bool -&#62; IO ()
-endHostEntry        :: IO ()
-</ProgramListing>
-</Para>
-
-<Para>
-The <Literal>SocketPrim</Literal> interface provides quite direct access to
-the socket facilities in a BSD Unix system, including all the
-complications.  We hope you don't need to use it!  See the source if
-needed&hellip;
-</Para>
-
-<Para>
-The <Literal>Socket</Literal> interface is a ``higher-level'' interface to
-sockets, and it is what we recommend.  Please tell us if the facilities it
-offers are inadequate to your task!
-</Para>
-
-<Para>
-The interface is relatively modest:
-
-<ProgramListing>
-connectTo       :: Hostname -&#62; PortID -&#62; IO Handle
-listenOn        :: PortID -&#62; IO Socket
-
-accept          :: Socket -&#62; IO (Handle, HostName)
-sendTo          :: Hostname -&#62; PortID -&#62; String -&#62; IO ()
-
-recvFrom        :: Hostname -&#62; PortID -&#62; IO String
-socketPort      :: Socket -&#62; IO PortID
-
-data PortID     -- PortID is a non-abstract type
-  = Service String        -- Service Name eg "ftp"
-  | PortNumber PortNumber -- User defined Port Number
-  | UnixSocket String     -- Unix family socket in file system
-
-type Hostname = String
-
- -- 16-bit value (stored in network byte order).
-data PortNumber
- -- instance of: Eq, Num, Show.
-
-mkPortNumber :: Int -&#62; PortNumber
-</ProgramListing>
-</Para>
-
-<Para>
-Various examples of networking Haskell code are provided in
-</Para>
-
-</Sect2>
-
-<Sect2 id="Select">
-<Title>The <Literal>Select</Literal> interface
-</Title>
-
-<Para>
-<IndexTerm><Primary>Select interface (misc syslib)</Primary></IndexTerm>
-</Para>
-
-<Para>
-The <Literal>Select</Literal> interface provides a Haskell wrapper for the <Function>select()</Function>
-OS call supplied by many modern UNIX variants. <Literal>Select</Literal> exports the
-following:
-</Para>
-
-<Para>
-
-<ProgramListing>
-type TimeOut = Maybe Int
-  -- Nothing =&#62; wait indefinitely.
-  -- Just x | x &#62;= 0    =&#62; block waiting for 'x' micro seconds.
-  --        | otherwise =&#62; block waiting for '-x' micro seconds.
-
-hSelect :: [Handle]
-        -&#62; [Handle]
-        -&#62; [Handle]
-        -&#62; TimeOut
-        -&#62; IO SelectResult
-
-type SelectResult
- = ( [Handle]  -- input  handles ready
-   , [Handle]  -- output handles ready
-   , [Handle]  -- exc.   handles ready
-   )
-</ProgramListing>
-
-</Para>
-
-<Para>
-Here's an example of how it could be used:
-</Para>
-
-<Para>
-
-<ProgramListing>
-module Main(main) where
-
-import Select
-import IO
-
-main :: IO ()
-main = do
-  hSetBuffering stdin NoBuffering
-  putStrLn "waiting for input to appear"
-  hSelect [stdin] [] [] Nothing
-  putStrLn "input ready, let's try reading"
-  x &#60;- getChar
-  print x
-</ProgramListing>
-
-</Para>
-
-<Para>
-where the call to <Function>hSelect</Function> makes the process go to sleep
-until there's input available on <VarName>stdin</VarName>.
-</Para>
-
-<Para>
-Notice that this particular use of <Function>hSelect</Function> is now really a no-op
-with GHC compiled code, as its implementation of IO will take care to
-avoid blocking the process (i.e., all running Haskell threads), and
-call <Function>select()</Function> for you, if needs be. However, <Function>hSelect</Function> exposes
-functionality that is useful in other contexts (e.g., you want to
-wait for input on two <Literal>Handles</Literal> for 3 seconds, but no longer.)
-</Para>
-
-</Sect2>
-
-</Sect1>
index 7fe9cfa..1463301 100644 (file)
@@ -91,17 +91,6 @@ flag).
 
 </Sect1>
 
-<Sect1>
-<Title>GHC/Hugs Extension Libraries</Title>
-
-<Para>
-The extension libraries provided by both GHC and Hugs are described in
-the
-<ULink
-URL="libs.html">GHC/Hugs Extension Library Document</ULink>
-</Para>
-
-</Sect1>
 
 <Sect1>
 <Title>GHC-only Extension Libraries</Title>
@@ -120,73 +109,11 @@ Haskell report says (modulo a few minor issues, see <XRef LinkEnd="vs-Haskell-de
 </Para>
 
 <Para>
-If you turn on <Option>-fglasgow-exts</Option>, a new world opesn up to you and the compiler
+If you turn on <Option>-fglasgow-exts</Option>, a new world opens up to you and the compiler
 will recognise and parse unboxed values properly, and provide access to the
 various interfaces libraries described here (and piles of other goodies.)
 </Para>
 
-&mutablearray
-&bytearray
-
-<Sect2>
-<Title>The <Literal>CCall</Literal> module</Title>
-
-<Para>
-The <Literal>CCall</Literal> module defines the classes <Literal>CCallable</Literal> and <Literal>CReturnable</Literal>,
-along with instances for the primitive types (<Literal>Int</Literal>, <Literal>Int&num;</Literal>, <Literal>Float</Literal>,
-<Literal>Float&num;</Literal> etc.)  GHC knows to import this module if you use <Function>&lowbar;ccall&lowbar;</Function>,
-but if you need to define your own instances of these classes, you
-will need to import <Literal>CCall</Literal> explicitly.
-</Para>
-
-<Para>
-More information on how to use <Function>&lowbar;ccall&lowbar;</Function> can be found in <XRef LinkEnd="glasgow-ccalls">.
-</Para>
-
-</Sect2>
-
-<Sect2>
-<Title>The <Literal>GlaExts</Literal> interface</Title>
-
-<Para>
-<IndexTerm><Primary>GlaExts interface (GHC extensions)</Primary></IndexTerm>
-</Para>
-
-<Para>
-The <Literal>GlaExts</Literal> interface provides access to extensions that only GHC
-implements.  These currently are: unboxed types, including the
-representations of the primitive types (Int, Float, etc.), and the
-GHC primitive operations (<Function>+&num;</Function>, <Function>==&num;</Function>, etc.).
-</Para>
-
-<Para>
-This module used to provide access to all the Glasgow extensions, but
-these have since been moved into separate libraries for compatibility
-with Hugs (version 2.09: in fact, you can still get at this stuff via
-<Literal>GlaExts</Literal> for compatibility, but this facility will likely be removed
-in the future).
-</Para>
-
-<Para>
-
-<ProgramListing>
--- the representation of some basic types:
-data Char    = C# Char#
-data Int     = I# Int#
-data Addr    = A# Addr#
-data Word    = W# Word#
-data Float   = F# Float#
-data Double  = D# Double#
-data Integer = S# Int#              -- small integers
-             | J# Int# ByteArray#   -- large integers
-
-module GHC  -- all primops and primitive types.
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
 </Sect1>
 
 <Sect1 id="ghc-libs-ghc">
@@ -337,9 +264,6 @@ allocation during sequences of operations.
 <IndexTerm><Primary>numeric types, primitive</Primary></IndexTerm>
 <IndexTerm><Primary>integer types, primitive</Primary></IndexTerm>
 <IndexTerm><Primary>floating point types, primitive</Primary></IndexTerm>
-</Para>
-
-<Para>
 There are the following obvious primitive types:
 </Para>
 
@@ -989,16 +913,12 @@ realWorld# :: State# RealWorld
 
 </Sect2>
 
-<Sect2>
+<Sect2 id="sect-mutable">
 <Title>Mutable arrays</Title>
 
 <Para>
-<Anchor id="sect-mutable">
 <IndexTerm><Primary>mutable arrays</Primary></IndexTerm>
 <IndexTerm><Primary>arrays, mutable</Primary></IndexTerm>
-</Para>
-
-<Para>
 Corresponding to <Literal>Array&num;</Literal> and <Literal>ByteArray&num;</Literal>, we have the types of
 mutable versions of each.  In each case, the representation is a
 pointer to a suitable block of (mutable) heap-allocated storage.
@@ -1153,119 +1073,6 @@ unsafeFreezeByteArray# :: MutableByteArray# s -&#62; State# s -&#62; (# State# s
 </Sect2>
 
 <Sect2>
-<Title>Stable pointers</Title>
-
-<Para>
-<IndexTerm><Primary>stable pointers</Primary></IndexTerm>
-<IndexTerm><Primary>pointers, stable</Primary></IndexTerm>
-</Para>
-
-<Para>
-A stable pointer is a name for a Haskell object which can be passed to
-the external world.  It is ``stable'' in the sense that the name does
-not change when the Haskell garbage collector runs&mdash;in contrast to
-the address of the object which may well change.
-</Para>
-
-<Para>
-The stable pointer type is parameterised by the type of the thing
-which is named.
-</Para>
-
-<Para>
-
-<ProgramListing>
-type StablePtr# a
-</ProgramListing>
-
-<IndexTerm><Primary><literal>StablePtr&num;</literal></Primary></IndexTerm>
-</Para>
-
-<Para>
-A stable pointer is represented by an index into the (static)
-<Literal>StablePointerTable</Literal>.  The Haskell garbage collector treats the
-<Literal>StablePointerTable</Literal> as a source of roots for GC.
-</Para>
-
-<Para>
-The <Function>makeStablePointer</Function> function converts a value into a stable
-pointer.  It is part of the <Literal>IO</Literal> monad, because we want to be sure
-we don't allocate one twice by accident, and then only free one of the
-copies.
-</Para>
-
-<Para>
-
-<ProgramListing>
-makeStablePointer#  :: a -&#62; State# RealWorld -&#62; (# State# RealWord, StablePtr# a #)
-freeStablePointer#  :: StablePtr# a -&#62; State# RealWorld -&#62; State# RealWorld
-deRefStablePointer# :: StablePtr# a -&#62; State# RealWorld -&#62; (# State# RealWorld, a #)
-</ProgramListing>
-
-<IndexTerm><Primary><literal>makeStablePointer&num;</literal></Primary></IndexTerm>
-<IndexTerm><Primary><literal>freeStablePointer&num;</literal></Primary></IndexTerm>
-<IndexTerm><Primary><literal>deRefStablePointer&num;</literal></Primary></IndexTerm>
-</Para>
-
-<Para>
-There is also a C procedure <Function>FreeStablePtr</Function> which frees a stable pointer.
-</Para>
-
-</Sect2>
-
-<Sect2>
-<Title>Foreign objects</Title>
-
-<Para>
-<IndexTerm><Primary>Foreign objects</Primary></IndexTerm>
-</Para>
-
-<Para>
-A <Literal>ForeignObj&num;</Literal> is a reference to an object outside the Haskell world
-(i.e., from the C world, or a reference to an object on another
-machine completely.), where the Haskell world has been told ``Let me
-know when you're finished with this&hellip;''.
-</Para>
-
-<Para>
-
-<ProgramListing>
-type ForeignObj#
-</ProgramListing>
-
-<IndexTerm><Primary><literal>ForeignObj&num;</literal></Primary></IndexTerm>
-</Para>
-
-<Para>
-GHC provides two primitives on <Literal>ForeignObj&num;</Literal>:
-</Para>
-
-<Para>
-
-<ProgramListing>
-makeForeignObj#
-        :: Addr# -- foreign reference
-        -&#62; Addr# -- pointer to finalisation routine
-        -&#62; (# State# RealWorld, ForeignObj# )
-writeForeignObj
-        :: ForeignObj#        -- foreign object
-        -&#62; Addr#              -- datum
-        -&#62; State# RealWorld
-        -&#62; State# RealWorld
-</ProgramListing>
-
-<IndexTerm><Primary><literal>makeForeignObj&num;</literal></Primary></IndexTerm>
-<IndexTerm><Primary><literal>writeForeignObj&num;</literal></Primary></IndexTerm>
-</Para>
-
-<Para>
-The module <Literal>Foreign</Literal> (see library documentation) provides a more
-programmer-friendly interface to foreign objects.
-</Para>
-
-</Sect2>
-
-<Sect2>
 <Title>Synchronizing variables (M-vars)</Title>
 
 <Para>
@@ -1299,7 +1106,4 @@ putMVar#    :: SynchVar# s elt -&#62; State# s -&#62; State# s
 
 </Sect1>
 
-&posix
-&libmisc
-
 </Chapter>
diff --git a/ghc/docs/users_guide/posix.sgml b/ghc/docs/users_guide/posix.sgml
deleted file mode 100644 (file)
index 8fc8994..0000000
+++ /dev/null
@@ -1,2368 +0,0 @@
-<Sect1 id="Posix-library">
-<Title>The Posix library
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix library</Primary></IndexTerm>
-<IndexTerm><Primary>libraries, Posix</Primary></IndexTerm>
-</Para>
-
-<Para>
-The <Literal>Posix</Literal> interface gives you access to the set of OS
-services standardised by POSIX 1003.1b (or the <Emphasis>IEEE Portable
-Operating System Interface for Computing Environments</Emphasis> - IEEE Std.
-1003.1). The interface is accessed by <Literal>import Posix</Literal> and
-adding <Option>-syslib posix</Option> on your command-line.
-</Para>
-
-<Sect2 id="Posix-data-types">
-<Title>Posix data types
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, data types</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-data ByteCount  -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>ByteCount</Literal> is a primitive of type <Literal>unsigned</Literal>. At a minimum,
-an conforming implementation must support values in the range
-<Literal>[0, UINT&lowbar;MAX]</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data ClockTick  -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>ClockTick</Literal> is a primitive of type <Literal>clock&lowbar;t</Literal>, which
-is used to measure intervals of time in fractions of a second.  The 
-resolution is determined by <Literal>getSysVar ClockTick</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data DeviceID  -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>DeviceID</Literal> is a primitive of type <Literal>dev&lowbar;t</Literal>.  It must
-be an arithmetic type.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data EpochTime -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>EpochTime</Literal> is a primitive of type <Literal>time&lowbar;t</Literal>, which is
-used to measure seconds since the Epoch.  At a minimum, the implementation 
-must support values in the range <Literal>[0, INT&lowbar;MAX]</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data FileID -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>FileID</Literal> is a primitive of type <Literal>ino&lowbar;t</Literal>.  It must
-be an arithmetic type.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data FileMode -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>FileMode</Literal> is a primitive of type <Literal>mode&lowbar;t</Literal>.
-It must be an arithmetic type.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data FileOffset -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>FileOffset</Literal> is a primitive of type <Literal>off&lowbar;t</Literal>.  It must
-be an arithmetic type.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data GroupID -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>GroupID</Literal> is a primitive of type <Literal>gid&lowbar;t</Literal>.  It must
-be an arithmetic type.
-
-<ProgramListing>
-data Limit -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>Limit</Literal> is a primitive of type <Literal>long</Literal>.
-At a minimum, the implementation must support values in the range 
-<Literal>[LONG&lowbar;MIN, LONG&lowbar;MAX]</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data LinkCount -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>LinkCount</Literal> is a primitive of type <Literal>nlink&lowbar;t</Literal>.  It must
-be an arithmetic type.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data ProcessID -- instances of : Eq Ord Num Real Integral Ix Enum Show
-type ProcessGroupID = ProcessID
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>ProcessID</Literal> is a primitive of type <Literal>pid&lowbar;t</Literal>.  It
-must be a signed arithmetic type.
-
-<ProgramListing>
-data UserID -- instances of : Eq Ord Num Real Integral Ix Enum Show
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>UserID</Literal> is a primitive of type <Literal>uid&lowbar;t</Literal>.  It
-must be an arithmetic type.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data DirStream
-</ProgramListing>
-
-A <Literal>DirStream</Literal> is a primitive of type <Literal>DIR *</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data FileStatus
-</ProgramListing>
-
-A <Literal>FileStatus</Literal> is a primitive of type <Literal>struct stat</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data GroupEntry
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>GroupEntry</Literal> is a primitive of type <Literal>struct group</Literal>.
-
-<ProgramListing>
-data ProcessTimes
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>ProcessTimes</Literal> is a primitive structure containing a
-<Literal>clock&lowbar;t</Literal> and a <Literal>struct tms</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data SignalSet
-</ProgramListing>
-
-</Para>
-
-<Para>
-An <Literal>SignalSet</Literal> is a primitive of type <Literal>sigset&lowbar;t</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data SystemID
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>SystemID</Literal> is a primitive of type <Literal>struct utsname</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data TerminalAttributes
-</ProgramListing>
-
-<Literal>TerminalAttributes</Literal> is a primitive of type <Literal>struct termios</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data UserEntry
-</ProgramListing>
-
-</Para>
-
-<Para>
-A <Literal>UserEntry</Literal> is a primitive of type <Literal>struct passwd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-data BaudRate = B0 | B50 | B75 | B110 | B134 | B150 | B200 | B300 | B600
-              | B1200 | B1800 | B2400 | B4800 | B9600 | B19200 | B38400
-              deriving (Eq, Show)
-
-data Fd 
-
-intToFd :: Int -&#62; Fd -- use with care.
-
-data FdOption = AppendOnWrite
-              | CloseOnExec
-              | NonBlockingRead
-
-data ControlCharacter = EndOfFile
-                      | EndOfLine
-                      | Erase
-                      | Interrupt
-                      | Kill
-                      | Quit
-                      | Suspend
-                      | Start
-                      | Stop
-
-type ErrorCode = Int
-
-type FileLock = (LockRequest, SeekMode, FileOffset, FileOffset)
---                            whence    start       length
-
-data FlowAction = SuspendOutput | RestartOutput | TransmitStop | TransmitStart
-
-data Handler = Default | Ignore | Catch (IO ())
-
-data LockRequest = ReadLock | WriteLock | Unlock
-                 deriving (Eq, Show)
-
-data OpenMode = ReadOnly | WriteOnly | ReadWrite
-
-data PathVar = LinkLimit
-             | InputLineLimit
-             | InputQueueLimit
-             | FileNameLimit
-             | PathNameLimit
-             | PipeBufferLimit
-             | SetOwnerAndGroupIsRestricted
-             | FileNamesAreNotTruncated
-
-data QueueSelector = InputQueue | OutputQueue | BothQueues
-
-type Signal = Int
-
-data SysVar = ArgumentLimit
-            | ChildLimit
-            | ClockTick
-            | GroupLimit
-            | OpenFileLimit
-            | PosixVersion
-            | HasSavedIDs
-            | HasJobControl
-
-data TerminalMode = InterruptOnBreak       -- BRKINT
-                | MapCRtoLF                -- ICRNL
-                | IgnoreBreak              -- IGNBRK
-                | IgnoreCR                 -- IGNCR
-                | IgnoreParityErrors       -- IGNPAR
-                | MapLFtoCR                -- INLCR
-                | CheckParity              -- INPCK
-                | StripHighBit             -- ISTRIP
-                | StartStopInput           -- IXOFF
-                | StartStopOutput          -- IXON
-                | MarkParityErrors         -- PARMRK
-                | ProcessOutput            -- OPOST
-                | LocalMode                -- CLOCAL
-                | ReadEnable               -- CREAD
-                | TwoStopBits              -- CSTOPB
-                | HangupOnClose            -- HUPCL
-                | EnableParity             -- PARENB
-                | OddParity                -- PARODD
-                | EnableEcho               -- ECHO
-                | EchoErase                -- ECHOE
-                | EchoKill                 -- ECHOK
-                | EchoLF                   -- ECHONL
-                | ProcessInput             -- ICANON
-                | ExtendedFunctions        -- IEXTEN
-                | KeyboardInterrupts       -- ISIG
-                | NoFlushOnInterrupt       -- NOFLSH
-                | BackgroundWriteInterrupt -- TOSTOP
-
-data TerminalState = Immediately | WhenDrained | WhenFlushed
-
-data ProcessStatus = Exited ExitCode 
-                   | Terminated Signal 
-                   | Stopped Signal
-                   deriving (Eq, Show)
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-<Sect2 id="Process-Primitives">
-<Title>Posix Process Primitives
-</Title>
-
-<Para>
-
-<ProgramListing>
-forkProcess :: IO (Maybe ProcessID)
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>forkProcess</Function> calls <Function>fork</Function>, returning
-<Literal>Just pid</Literal> to the parent, where <VarName>pid</VarName> is the
-ProcessID of the child, and returning <Literal>Nothing</Literal> to the
-child.
-</Para>
-
-<Para>
-
-<ProgramListing>
-executeFile :: FilePath                   -- Command
-            -&#62; Bool                       -- Search PATH?
-            -&#62; [String]                   -- Arguments
-            -&#62; Maybe [(String, String)]   -- Environment
-            -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>executeFile cmd args env</Literal> calls one of the
-<Function>execv*</Function> family, depending on whether or not the current
-PATH is to be searched for the command, and whether or not an
-environment is provided to supersede the process's current
-environment.  The basename (leading directory names suppressed) of
-the command is passed to <Function>execv*</Function> as <VarName>arg[0]</VarName>;
-the argument list passed to <Function>executeFile</Function> therefore begins with <VarName>arg[1]</VarName>.
-</Para>
-
-<Para>
-
-<Screen>
-Search PATH?    Supersede environ?      Call
-~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~      ~~~~~~~
-False           False                   execv
-False           True                    execve
-True            False                   execvp
-True            True                    execvpe*
-</Screen>
-
-</Para>
-
-<Para>
-Note that <Function>execvpe</Function> is not provided by the POSIX standard, and must
-be written by hand.  Care must be taken to ensure that the search path
-is extracted from the original environment, and not from the
-environment to be passed on to the new image.
-</Para>
-
-<Para>
-NOTE: In general, sharing open files between parent and child
-processes is potential bug farm, and should be avoided unless you
-really depend on this `feature' of POSIX' <Function>fork()</Function> semantics. Using
-Haskell, there's the extra complication that arguments to
-<Function>executeFile</Function> might come from files that are read lazily (using
-<Function>hGetContents</Function>, or some such.) If this is the case, then for your own
-sanity, please ensure that the arguments to <Function>executeFile</Function> have been
-fully evaluated before calling <Function>forkProcess</Function> (followed by
-<Function>executeFile</Function>.) Consider yourself warned :-)
-</Para>
-
-<Para>
-A successful <Function>executeFile</Function> overlays the current process image with 
-a new one, so it only returns on failure.
-</Para>
-
-<Para>
-
-<ProgramListing>
-runProcess :: FilePath                    -- Command
-           -&#62; [String]                    -- Arguments
-           -&#62; Maybe [(String, String)]    -- Environment (Nothing -&#62; Inherited)
-           -&#62; Maybe FilePath              -- Working directory (Nothing -&#62; inherited)
-           -&#62; Maybe Handle                -- stdin  (Nothing -&#62; inherited)
-           -&#62; Maybe Handle                -- stdout (Nothing -&#62; inherited)
-           -&#62; Maybe Handle                -- stderr (Nothing -&#62; inherited)
-           -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>runProcess</Function> is our candidate for the high-level OS-independent
-primitive.
-</Para>
-
-<Para>
-<Literal>runProcess cmd args env wd inhdl outhdl errhdl</Literal> runs <Command>cmd</Command>
-(searching the current <Literal>PATH</Literal>) with arguments <Literal>args</Literal>.  If
-<Literal>env</Literal> is <Literal>Just pairs</Literal>, the command is executed with the
-environment specified by <Literal>pairs</Literal> of variables and values;
-otherwise, the command is executed with the current environment.  If
-<Literal>wd</Literal> is <Literal>Just dir</Literal>, the command is executed with working
-directory <Literal>dir</Literal>; otherwise, the command is executed in the current
-working directory.  If <Literal>&lcub;in,out,err</Literal>hdl&rcub; is <Literal>Just handle</Literal>, the
-command is executed with the <Literal>Fd</Literal> for <Literal>std&lcub;in,out,err</Literal>&rcub;
-attached to the specified <Literal>handle</Literal>; otherwise, the <Literal>Fd</Literal> for
-<Literal>std&lcub;in,out,err</Literal>&rcub; is left unchanged.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getProcessStatus :: Bool              -- Block?
-                 -&#62; Bool              -- Stopped processes?
-                 -&#62; ProcessID 
-                 -&#62; IO (Maybe ProcessStatus)
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getProcessStatus blk stopped pid</Literal> calls <Function>waitpid</Function>, returning
-<Literal>Just tc</Literal>, the <Literal>ProcessStatus</Literal> for process <Literal>pid</Literal> if it is
-available, <Literal>Nothing</Literal> otherwise.  If <Literal>blk</Literal> is <Literal>False</Literal>, then
-<Literal>WNOHANG</Literal> is set in the options for <Function>waitpid</Function>, otherwise not.
-If <Literal>stopped</Literal> is <Literal>True</Literal>, then <Literal>WUNTRACED</Literal> is set in the
-options for <Function>waitpid</Function>, otherwise not.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getGroupProcessStatus :: Bool         -- Block?
-                      -&#62; Bool         -- Stopped processes?
-                      -&#62; ProcessGroupID 
-                      -&#62; IO (Maybe (ProcessID, ProcessStatus))
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getGroupProcessStatus blk stopped pgid</Literal> calls <Function>waitpid</Function>,
-returning <Literal>Just (pid, tc)</Literal>, the <Literal>ProcessID</Literal> and
-<Literal>ProcessStatus</Literal> for any process in group <Literal>pgid</Literal> if one is
-available, <Literal>Nothing</Literal> otherwise.  If <Literal>blk</Literal> is <Literal>False</Literal>, then
-<Literal>WNOHANG</Literal> is set in the options for <Function>waitpid</Function>, otherwise not.
-If <Literal>stopped</Literal> is <Literal>True</Literal>, then <Literal>WUNTRACED</Literal> is set in the
-options for <Function>waitpid</Function>, otherwise not.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getAnyProcessStatus :: Bool           -- Block?
-                    -&#62; Bool           -- Stopped processes?
-                    -&#62; IO (Maybe (ProcessID, ProcessStatus))
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getAnyProcessStatus blk stopped</Literal> calls <Function>waitpid</Function>, returning
-<Literal>Just (pid, tc)</Literal>, the <Literal>ProcessID</Literal> and <Literal>ProcessStatus</Literal> for any
-child process if one is available, <Literal>Nothing</Literal> otherwise.  If
-<Literal>blk</Literal> is <Literal>False</Literal>, then <Literal>WNOHANG</Literal> is set in the options for
-<Function>waitpid</Function>, otherwise not.  If <Literal>stopped</Literal> is <Literal>True</Literal>, then
-<Literal>WUNTRACED</Literal> is set in the options for <Function>waitpid</Function>, otherwise not.
-</Para>
-
-<Para>
-
-<ProgramListing>
-exitImmediately :: ExitCode -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>exitImmediately status</Literal> calls <Function>&lowbar;exit</Function> to terminate the process
-with the indicated exit <Literal>status</Literal>.
-The operation never returns.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getEnvironment :: IO [(String, String)]
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getEnvironment</Function> parses the environment variable mapping provided by
-<Literal>environ</Literal>, returning <Literal>(variable, value)</Literal> pairs. 
-The operation never fails.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setEnvironment :: [(String, String)] -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>setEnvironment</Function> replaces the process environment with the provided
-mapping of <Literal>(variable, value)</Literal> pairs. 
-</Para>
-
-<Para>
-
-<ProgramListing>
-getEnvVar :: String -&#62; IO String
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getEnvVar var</Literal> returns the value associated with variable <VarName>var</VarName> 
-in the current environment (identical functionality provided through
-standard Haskell library function <Function>System.getEnv</Function>).
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-The variable has no mapping in the current environment.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-setEnvVar :: String -&#62; String -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setEnvVar var val</Literal> sets the value associated with variable <VarName>var</VarName> 
-in the current environment to be <Literal>val</Literal>.  Any previous mapping is 
-superseded.
-</Para>
-
-<Para>
-
-<ProgramListing>
-removeEnvVar :: String -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>removeEnvVar var</Literal> removes any value associated with variable <VarName>var</VarName> 
-in the current environment.  Deleting a variable for which there is no mapping
-does not generate an error.
-</Para>
-
-<Para>
-
-<ProgramListing>
-nullSignal :: Signal
-nullSignal = 0
-
-backgroundRead, sigTTIN        :: Signal
-backgroundWrite, sigTTOU       :: Signal
-continueProcess, sigCONT       :: Signal
-floatingPointException, sigFPE :: Signal
-illegalInstruction, sigILL     :: Signal
-internalAbort, sigABRT         :: Signal
-keyboardSignal, sigINT         :: Signal
-keyboardStop, sigTSTP          :: Signal
-keyboardTermination, sigQUIT   :: Signal
-killProcess, sigKILL           :: Signal
-lostConnection, sigHUP         :: Signal
-openEndedPipe, sigPIPE         :: Signal
-processStatusChanged, sigCHLD  :: Signal
-realTimeAlarm, sigALRM         :: Signal
-segmentationViolation, sigSEGV :: Signal
-softwareStop, sigSTOP          :: Signal
-softwareTermination, sigTERM   :: Signal
-userDefinedSignal1, sigUSR1    :: Signal
-userDefinedSignal2, sigUSR2    :: Signal
-
-signalProcess :: Signal -&#62; ProcessID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>signalProcess int pid</Literal> calls <Function>kill</Function> to signal 
-process <Literal>pid</Literal> with interrupt signal <Literal>int</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-raiseSignal :: Signal -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>raiseSignal int</Literal> calls <Function>kill</Function> to signal the current process
-with interrupt signal <Literal>int</Literal>. 
-</Para>
-
-<Para>
-
-<ProgramListing>
-signalProcessGroup :: Signal -&#62; ProcessGroupID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>signalProcessGroup int pgid</Literal> calls <Function>kill</Function> to signal 
-all processes in group <Literal>pgid</Literal> with interrupt signal <Literal>int</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setStoppedChildFlag :: Bool -&#62; IO Bool
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setStoppedChildFlag bool</Literal> sets a flag which controls whether or
-not the <Constant>NOCLDSTOP</Constant> option will be used the next time a signal
-handler is installed for <Constant>SIGCHLD</Constant>.  If <Literal>bool</Literal> is <Literal>True</Literal> (the
-default), <Constant>NOCLDSTOP</Constant> will not be used; otherwise it will be.  The
-operation never fails.
-</Para>
-
-<Para>
-
-<ProgramListing>
-queryStoppedChildFlag :: IO Bool
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>queryStoppedChildFlag</Function> queries the flag which
-controls whether or not the <Constant>NOCLDSTOP</Constant> option will be used
-the next time a signal handler is installed for <Constant>SIGCHLD</Constant>.
-If <Constant>NOCLDSTOP</Constant> will be used, it returns <Literal>False</Literal>; 
-otherwise (the default) it returns <Literal>True</Literal>.  
-The operation never fails.
-</Para>
-
-<Para>
-
-<ProgramListing>
-emptySignalSet :: SignalSet
-fullSignalSet  :: SignalSet
-addSignal      :: Signal -&#62; SignalSet -&#62; SignalSet
-deleteSignal   :: Signal -&#62; SignalSet -&#62; SignalSet
-inSignalSet    :: Signal -&#62; SignalSet -&#62; Bool
-
-installHandler :: Signal
-               -&#62; Handler 
-               -&#62; Maybe SignalSet       -- other signals to block
-               -&#62; IO Handler            -- old handler
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>installHandler int handler iset</Literal> calls <Constant>sigaction</Constant> to install an
-interrupt handler for signal <Literal>int</Literal>.  If <Literal>handler</Literal> is <Literal>Default</Literal>,
-<Constant>SIG&lowbar;DFL</Constant> is installed; if <Literal>handler</Literal> is <Literal>Ignore</Literal>, <Constant>SIG&lowbar;IGN</Constant> is
-installed; if <Literal>handler</Literal> is <Literal>Catch action</Literal>, a handler is installed
-which will invoke <Literal>action</Literal> in a new thread when (or shortly after) the
-signal is received.  See <XRef LinkEnd="concurrent-haskell"> for details on how to communicate between
-threads.
-</Para>
-
-<Para>
-If <Literal>iset</Literal> is <Literal>Just s</Literal>, then the <VarName>sa&lowbar;mask</VarName> of the <Literal>sigaction</Literal> structure
-is set to <Literal>s</Literal>; otherwise it is cleared.  The previously installed
-signal handler for <Literal>int</Literal> is returned.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getSignalMask :: IO SignalSet
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getSignalMask</Function> calls <Function>sigprocmask</Function> to determine the
-set of interrupts which are currently being blocked.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setSignalMask :: SignalSet -&#62; IO SignalSet
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setSignalMask mask</Literal> calls <Function>sigprocmask</Function> with
-<Constant>SIG&lowbar;SETMASK</Constant> to block all interrupts in <Literal>mask</Literal>.  The
-previous set of blocked interrupts is returned.
-</Para>
-
-<Para>
-
-<ProgramListing>
-blockSignals :: SignalSet -&#62; IO SignalSet
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setSignalMask mask</Literal> calls <Function>sigprocmask</Function> with
-<Constant>SIG&lowbar;BLOCK</Constant> to add all interrupts in <Literal>mask</Literal> to the
-set of blocked interrupts.  The previous set of blocked interrupts is returned.
-</Para>
-
-<Para>
-
-<ProgramListing>
-unBlockSignals :: SignalSet -&#62; IO SignalSet
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setSignalMask mask</Literal> calls <Function>sigprocmask</Function> with
-<Constant>SIG&lowbar;UNBLOCK</Constant> to remove all interrupts in <Literal>mask</Literal> from the
-set of blocked interrupts.  The previous set of blocked interrupts is returned.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getPendingSignals :: IO SignalSet
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getPendingSignals</Function> calls <Function>sigpending</Function> to obtain
-the set of interrupts which have been received but are currently blocked.
-</Para>
-
-<Para>
-
-<ProgramListing>
-awaitSignal :: Maybe SignalSet -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>awaitSignal iset</Literal> suspends execution until an interrupt is received.
-If <Literal>iset</Literal> is <Literal>Just s</Literal>, <Function>awaitSignal</Function> calls <Function>sigsuspend</Function>, installing
-<Literal>s</Literal> as the new signal mask before suspending execution; otherwise, it
-calls <Function>pause</Function>.  <Function>awaitSignal</Function> returns on receipt of a signal.  If you
-have installed any signal handlers with <Function>installHandler</Function>, it may be
-wise to call <Function>yield</Function> directly after <Function>awaitSignal</Function> to ensure that the
-signal handler runs as promptly.
-</Para>
-
-<Para>
-
-<ProgramListing>
-scheduleAlarm :: Int -&#62; IO Int
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>scheduleAlarm i</Literal> calls <Function>alarm</Function> to schedule a real time
-alarm at least <Literal>i</Literal> seconds in the future.
-</Para>
-
-<Para>
-
-<ProgramListing>
-sleep :: Int -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>sleep i</Literal> calls <Function>sleep</Function> to suspend execution of the
-program until at least <Literal>i</Literal> seconds have elapsed or a signal is
-received.
-</Para>
-
-</Sect2>
-
-<Sect2 id="Process-Environment">
-<Title>Posix Process Environment
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, process environment</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-getProcessID :: IO ProcessID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getProcessID</Function> calls <Function>getpid</Function> to obtain the <Literal>ProcessID</Literal> for
-the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getParentProcessID :: IO ProcessID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getProcessID</Function> calls <Function>getppid</Function> to obtain the <Literal>ProcessID</Literal> for
-the parent of the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getRealUserID :: IO UserID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getRealUserID</Function> calls <Function>getuid</Function> to obtain the real <Literal>UserID</Literal>
-associated with the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getEffectiveUserID :: IO UserID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getRealUserID</Function> calls <Function>geteuid</Function> to obtain the effective
-<Literal>UserID</Literal> associated with the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setUserID :: UserID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setUserID uid</Literal> calls <Function>setuid</Function> to set the real, effective, and
-saved set-user-id associated with the current process to <Literal>uid</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getLoginName :: IO String
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getLoginName</Function> calls <Function>getlogin</Function> to obtain the login name
-associated with the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getRealGroupID :: IO GroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getRealGroupID</Function> calls <Function>getgid</Function> to obtain the real <Literal>GroupID</Literal>
-associated with the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getEffectiveGroupID :: IO GroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getEffectiveGroupID</Function> calls <Function>getegid</Function> to obtain the effective
-<Literal>GroupID</Literal> associated with the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setGroupID :: GroupID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setGroupID gid</Literal> calls <Function>setgid</Function> to set the real, effective, and
-saved set-group-id associated with the current process to <Literal>gid</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getGroups :: IO [GroupID]
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getGroups</Function> calls <Function>getgroups</Function> to obtain the list of
-supplementary <Literal>GroupID</Literal>s associated with the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getEffectiveUserName :: IO String
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getEffectiveUserName</Function> calls <Function>cuserid</Function> to obtain a name
-associated with the effective <Literal>UserID</Literal> of the process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getProcessGroupID :: IO ProcessGroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getProcessGroupID</Function> calls <Function>getpgrp</Function> to obtain the
-<Literal>ProcessGroupID</Literal> for the current process.
-</Para>
-
-<Para>
-
-<ProgramListing>
-createProcessGroup :: ProcessID -&#62; IO ProcessGroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>createProcessGroup pid</Literal> calls <Function>setpgid</Function> to make
-process <Literal>pid</Literal> a new process group leader.
-</Para>
-
-<Para>
-
-<ProgramListing>
-joinProcessGroup :: ProcessGroupID -&#62; IO ProcessGroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>joinProcessGroup pgid</Literal> calls <Function>setpgid</Function> to set the
-<Literal>ProcessGroupID</Literal> of the current process to <Literal>pgid</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setProcessGroupID :: ProcessID -&#62; ProcessGroupID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setProcessGroupID pid pgid</Literal> calls <Function>setpgid</Function> to set the
-<Literal>ProcessGroupID</Literal> for process <Literal>pid</Literal> to <Literal>pgid</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-createSession :: IO ProcessGroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>createSession</Function> calls <Function>setsid</Function> to create a new session
-with the current process as session leader.
-</Para>
-
-<Para>
-
-<ProgramListing>
-systemName :: SystemID -&#62; String
-nodeName :: SystemID -&#62; String
-release :: SystemID -&#62; String
-version :: SystemID -&#62; String
-machine :: SystemID -&#62; String
-
-getSystemID :: IO SystemID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getSystemID</Function> calls <Function>uname</Function> to obtain information
-about the current operating system.
-</Para>
-
-<Para>
-
-<ProgramListing>
-&#62; epochTime :: IO EpochTime
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>epochTime</Function> calls <Function>time</Function> to obtain the number of 
-seconds that have elapsed since the epoch (Jan 01 00:00:00 GMT 1970).
-</Para>
-
-<Para>
-
-<ProgramListing>
-elapsedTime     :: ProcessTimes -&#62; ClockTick
-userTime        :: ProcessTimes -&#62; ClockTick
-systemTime      :: ProcessTimes -&#62; ClockTick
-childUserTime   :: ProcessTimes -&#62; ClockTick
-childSystemTime :: ProcessTimes -&#62; ClockTick
-
-getProcessTimes :: IO ProcessTimes
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getProcessTimes</Function> calls <Function>times</Function> to obtain time-accounting
-information for the current process and its children.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getControllingTerminalName :: IO FilePath
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getControllingTerminalName</Function> calls <Function>ctermid</Function> to obtain
-a name associated with the controlling terminal for the process.  If a
-controlling terminal exists,
-<Function>getControllingTerminalName</Function> returns the name of the
-controlling terminal.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-There is no controlling terminal, or its name cannot be determined.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>SystemError</Literal></Term>
-<ListItem>
-<Para>
-Various other causes.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-getTerminalName :: Fd -&#62; IO FilePath
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getTerminalName fd</Literal> calls <Function>ttyname</Function> to obtain a name associated
-with the terminal for <Literal>Fd</Literal> <Literal>fd</Literal>. If <Literal>fd</Literal> is associated
-with a terminal, <Function>getTerminalName</Function> returns the name of the
-terminal.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>InappropriateType</Literal></Term>
-<ListItem>
-<Para>
-The channel is not associated with a terminal.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-The channel is associated with a terminal, but it has no name.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>SystemError</Literal></Term>
-<ListItem>
-<Para>
-Various other causes.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-queryTerminal :: Fd -&#62; IO Bool
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>queryTerminal fd</Literal> calls <Function>isatty</Function> to determine whether or
-not <Literal>Fd</Literal> <Literal>fd</Literal> is associated with a terminal.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getSysVar :: SysVar -&#62; IO Limit
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getSysVar var</Literal> calls <Function>sysconf</Function> to obtain the
-dynamic value of the requested configurable system limit or option.
-For defined system limits, <Function>getSysVar</Function> returns the associated
-value.  For defined system options, the result of <Function>getSysVar</Function>
-is undefined, but not failure.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-The requested system limit or option is undefined.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-</Sect2>
-
-<Sect2 id="Files-and-Directories">
-<Title>Posix operations on files and directories
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, files and directories</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-openDirStream :: FilePath -&#62; IO DirStream
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>openDirStream dir</Literal> calls <Function>opendir</Function> to obtain a
-directory stream for <Literal>dir</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-readDirStream :: DirStream -&#62; IO String
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>readDirStream dp</Literal> calls <Function>readdir</Function> to obtain the
-next directory entry (<Literal>struct dirent</Literal>) for the open directory
-stream <Literal>dp</Literal>, and returns the <VarName>d&lowbar;name</VarName> member of that
-structure.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>EOF</Literal></Term>
-<ListItem>
-<Para>
-End of file has been reached.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>SystemError</Literal></Term>
-<ListItem>
-<Para>
-Various other causes.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-rewindDirStream :: DirStream -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>rewindDirStream dp</Literal> calls <Function>rewinddir</Function> to reposition
-the directory stream <Literal>dp</Literal> at the beginning of the directory.
-</Para>
-
-<Para>
-
-<ProgramListing>
-closeDirStream :: DirStream -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>closeDirStream dp</Literal> calls <Function>closedir</Function> to close
-the directory stream <Literal>dp</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getWorkingDirectory :: IO FilePath
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getWorkingDirectory</Function> calls <Function>getcwd</Function> to obtain the name
-of the current working directory.
-</Para>
-
-<Para>
-
-<ProgramListing>
-changeWorkingDirectory :: FilePath -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>changeWorkingDirectory dir</Literal> calls <Function>chdir</Function> to change
-the current working directory to <Literal>dir</Literal>.
-</Para>
-
-<Para>
-<ProgramListing>
-nullFileMode       :: FileMode       -- ---------
-ownerReadMode      :: FileMode       -- r--------
-ownerWriteMode     :: FileMode       -- -w-------
-ownerExecuteMode   :: FileMode       -- --x------
-groupReadMode      :: FileMode       -- ---r-----
-groupWriteMode     :: FileMode       -- ----w----
-groupExecuteMode   :: FileMode       -- -----x---
-otherReadMode      :: FileMode       -- ------r--
-otherWriteMode     :: FileMode       -- -------w-
-otherExecuteMode   :: FileMode       -- --------x
-setUserIDMode      :: FileMode       -- --S------
-setGroupIDMode     :: FileMode       -- -----S---
-                               
-stdFileMode        :: FileMode       -- rw-rw-rw-
-                               
-ownerModes         :: FileMode       -- rwx------
-groupModes         :: FileMode       -- ---rwx---
-otherModes         :: FileMode       -- ------rwx
-accessModes        :: FileMode       -- rwxrwxrwx
-
-unionFileModes     :: FileMode -&#62; FileMode -&#62; FileMode
-intersectFileModes :: FileMode -&#62; FileMode -&#62; FileMode
-
-stdInput  :: Fd
-stdInput  = intToFd 0
-
-stdOutput :: Fd
-stdOutput = intToFd 1
-
-stdError  :: Fd
-stdError  = intToFd 2
-
-data OpenFileFlags =
- OpenFileFlags {
-    append    :: Bool,
-    exclusive :: Bool,
-    noctty    :: Bool,
-    nonBlock  :: Bool,
-    trunc     :: Bool
- }
-
-openFd :: FilePath
-       -&#62; OpenMode
-       -&#62; Maybe FileMode  -- Just x =&#62; O_CREAT, Nothing =&#62; must exist
-       -&#62; OpenFileFlags
-       -&#62; IO Fd
-</ProgramListing>
-</Para>
-
-<Para>
-<Literal>openFd path acc mode (OpenFileFlags app excl noctty nonblock trunc)</Literal> calls
-<Function>open</Function> to obtain a <Literal>Fd</Literal> for the file <Literal>path</Literal> with access
-mode <Literal>acc</Literal>.  If <Literal>mode</Literal> is <Literal>Just m</Literal>, the <Constant>O&lowbar;CREAT</Constant> flag is
-set and the file's permissions will be based on <Literal>m</Literal> if it does not
-already exist; otherwise, the <Constant>O&lowbar;CREAT</Constant> flag is not set.  The
-arguments <Literal>app</Literal>, <Literal>excl</Literal>, <Literal>noctty</Literal>, <Literal>nonblock</Literal>, and
-<Literal>trunc</Literal> control whether or not the flags <Constant>O&lowbar;APPEND</Constant>,
-<Constant>O&lowbar;EXCL</Constant>, <Constant>O&lowbar;NOCTTY</Constant>, <Constant>O&lowbar;NONBLOCK</Constant>, and <Constant>O&lowbar;TRUNC</Constant> are set,
-respectively.
-</Para>
-
-<Para>
-
-<ProgramListing>
-createFile :: FilePath -&#62; FileMode -&#62; IO Fd
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>createFile path mode</Literal> calls <Function>creat</Function> to obtain a <Literal>Fd</Literal>
-for file <Literal>path</Literal>, which will be created with permissions based on
-<Literal>mode</Literal> if it does not already exist.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setFileCreationMask :: FileMode -&#62; IO FileMode
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setFileCreationMask mode</Literal> calls <Function>umask</Function> to set
-the process's file creation mask to <Literal>mode</Literal>.  The previous file
-creation mask is returned.
-</Para>
-
-<Para>
-
-<ProgramListing>
-createLink :: FilePath -&#62; FilePath -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>createLink old new</Literal> calls <Function>link</Function> to create a 
-new path, <Literal>new</Literal>, linked to an existing file, <Literal>old</Literal>.
-
-<ProgramListing>
-createDirectory :: FilePath -&#62; FileMode -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>createDirectory dir mode</Literal> calls <Function>mkdir</Function> to 
-create a new directory, <Literal>dir</Literal>, with permissions based on
-<Literal>mode</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-createNamedPipe :: FilePath -&#62; FileMode -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>createNamedPipe fifo mode</Literal> calls <Function>mkfifo</Function> to 
-create a new named pipe, <Literal>fifo</Literal>, with permissions based on
-<Literal>mode</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-removeLink :: FilePath -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>removeLink path</Literal> calls <Function>unlink</Function> to remove the link
-named <Literal>path</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-removeDirectory :: FilePath -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>removeDirectory dir</Literal> calls <Function>rmdir</Function> to remove the 
-directory named <Literal>dir</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-rename :: FilePath -&#62; FilePath -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>rename old new</Literal> calls <Function>rename</Function> to rename a 
-file or directory from <Literal>old</Literal> to <Literal>new</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-fileMode          :: FileStatus -&#62; FileMode
-                   
-fileID            :: FileStatus -&#62; FileID
-deviceID          :: FileStatus -&#62; DeviceID
-                   
-linkCount         :: FileStatus -&#62; LinkCount
-                   
-fileOwner         :: FileStatus -&#62; UserID
-fileGroup         :: FileStatus -&#62; GroupID
-fileSize          :: FileStatus -&#62; FileOffset
-
-accessTime        :: FileStatus -&#62; EpochTime
-modificationTime  :: FileStatus -&#62; EpochTime
-statusChangeTime  :: FileStatus -&#62; EpochTime
-
-isDirectory       :: FileStatus -&#62; Bool
-isCharacterDevice :: FileStatus -&#62; Bool
-isBlockDevice     :: FileStatus -&#62; Bool
-isRegularFile     :: FileStatus -&#62; Bool
-isNamedPipe       :: FileStatus -&#62; Bool
-
-getFileStatus     :: FilePath -&#62; IO FileStatus
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getFileStatus path</Literal> calls <Function>stat</Function> to get the
-<Literal>FileStatus</Literal> information for the file <Literal>path</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getFdStatus :: Fd -&#62; IO FileStatus
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getFdStatus fd</Literal> calls <Function>fstat</Function> to get the
-<Literal>FileStatus</Literal> information for the file associated with
-<Literal>Fd</Literal> <Literal>fd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-queryAccess :: FilePath -&#62; Bool -&#62; Bool -&#62; Bool -&#62; IO Bool
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>queryAccess path r w x</Literal> calls <Function>access</Function> to test the access
-permissions for file <Literal>path</Literal>.  The three arguments, <Literal>r</Literal>, <Literal>w</Literal>,
-and <Literal>x</Literal> control whether or not <Function>access</Function> is called with
-<Constant>R&lowbar;OK</Constant>, <Constant>W&lowbar;OK</Constant>, and <Constant>X&lowbar;OK</Constant> respectively.
-</Para>
-
-<Para>
-
-<ProgramListing>
-queryFile :: FilePath -&#62; IO Bool
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>queryFile path</Literal> calls <Function>access</Function> with <Constant>F&lowbar;OK</Constant> to test for the
-existence for file <Literal>path</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setFileMode :: FilePath -&#62; FileMode -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setFileMode path mode</Literal> calls <Function>chmod</Function> to set the
-permission bits associated with file <Literal>path</Literal> to <Literal>mode</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setOwnerAndGroup :: FilePath -&#62; UserID -&#62; GroupID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setOwnerAndGroup path uid gid</Literal> calls <Function>chown</Function> to
-set the <Literal>UserID</Literal> and <Literal>GroupID</Literal> associated with file
-<Literal>path</Literal> to <Literal>uid</Literal> and <Literal>gid</Literal>, respectively.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setFileTimes :: FilePath -&#62; EpochTime -&#62; EpochTime -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setFileTimes path atime mtime</Literal> calls <Function>utime</Function> to
-set the access and modification times associated with file
-<Literal>path</Literal> to <Literal>atime</Literal> and <Literal>mtime</Literal>, respectively.
-</Para>
-
-<Para>
-
-<ProgramListing>
-touchFile :: FilePath -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>touchFile path</Literal> calls <Function>utime</Function> to
-set the access and modification times associated with file
-<Literal>path</Literal> to the current time.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getPathVar :: PathVar -&#62; FilePath -&#62; IO Limit
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getPathVar var path</Literal> calls <Function>pathconf</Function> to obtain the
-dynamic value of the requested configurable file limit or option associated
-with file or directory <Literal>path</Literal>.  For
-defined file limits, <Function>getPathVar</Function> returns the associated
-value.  For defined file options, the result of <Function>getPathVar</Function>
-is undefined, but not failure.
-The operation may fail with:
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-The requested file limit or option is undefined.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>SystemError</Literal></Term>
-<ListItem>
-<Para>
-Various other causes.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-getFdVar :: PathVar -&#62; Fd -&#62; IO Limit
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getFdVar var fd</Literal> calls <Function>fpathconf</Function> to obtain the
-dynamic value of the requested configurable file limit or option associated
-with the file or directory attached to the open channel <Literal>fd</Literal>.
-For defined file limits, <Function>getFdVar</Function> returns the associated
-value.  For defined file options, the result of <Function>getFdVar</Function>
-is undefined, but not failure.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-The requested file limit or option is undefined.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>SystemError</Literal></Term>
-<ListItem>
-<Para>
-Various other causes.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-</Sect2>
-
-<Sect2 id="Input-Output">
-<Title>Posix Input and Output Primitives
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, input/output</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-createPipe :: IO (Fd, Fd)
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>createPipe</Function> calls <Function>pipe</Function> to create a pipe and returns a pair of
-<Literal>Fd</Literal>s, the first for reading and the second for writing.
-</Para>
-
-<Para>
-
-<ProgramListing>
-dup :: Fd -&#62; IO Fd
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>dup fd</Literal> calls <Function>dup</Function> to duplicate <Literal>Fd</Literal> <Literal>fd</Literal> to
-another <Literal>Fd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-dupTo :: Fd -&#62; Fd -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>dupTo src dst</Literal> calls <Function>dup2</Function> to duplicate <Literal>Fd</Literal>
-<Literal>src</Literal> to <Literal>Fd</Literal> <Literal>dst</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-fdClose :: Fd -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>fdClose fd</Literal> calls <Function>close</Function> to close <Literal>Fd</Literal> <Literal>fd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-fdRead :: Fd -&#62; ByteCount -&#62; IO (String, ByteCount)
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>fdRead fd nbytes</Literal> calls <Function>read</Function> to read at most <Literal>nbytes</Literal>
-bytes from <Literal>Fd</Literal> <Literal>fd</Literal>, and returns the result as a string
-paired with the number of bytes actually read.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>EOF</Literal></Term>
-<ListItem>
-<Para>
-End of file has been reached.
-</Para>
-</ListItem>
-</VarListEntry>
-<VarListEntry>
-<Term><Literal>SystemError</Literal></Term>
-<ListItem>
-<Para>
-Various other causes.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-fdWrite :: Fd -&#62; String -&#62; IO ByteCount
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>fdWrite fd s</Literal> calls <Function>write</Function> to write
-the string <Literal>s</Literal> to <Literal>Fd</Literal> <Literal>fd</Literal> as a
-contiguous sequence of bytes.  It returns the number of bytes successfully
-written.
-</Para>
-
-<Para>
-
-<ProgramListing>
-queryFdOption :: FdOption -&#62; Fd -&#62; IO Bool
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getFdOption opt fd</Literal> calls <Function>fcntl</Function> to determine whether or
-not the flag associated with <Literal>FdOption</Literal> <Literal>opt</Literal> is set for
-<Literal>Fd</Literal> <Literal>fd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setFdOption :: Fd -&#62; FdOption -&#62; Bool -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setFdOption fd opt val</Literal> calls <Function>fcntl</Function> to set the flag
-associated with <Literal>FdOption</Literal> <Literal>opt</Literal> on <Literal>Fd</Literal> <Literal>fd</Literal> to
-<Literal>val</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getLock :: Fd -&#62; FileLock -&#62; IO (Maybe (ProcessID, FileLock))
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getLock fd lock</Literal> calls <Function>fcntl</Function> to get the first <Literal>FileLock</Literal>
-for <Literal>Fd</Literal> <Literal>fd</Literal> which blocks the <Literal>FileLock</Literal> <Literal>lock</Literal>.  If
-no such <Literal>FileLock</Literal> exists, <Function>getLock</Function> returns <Literal>Nothing</Literal>.
-Otherwise, it returns <Literal>Just (pid, block)</Literal>, where <Literal>block</Literal> is the
-blocking <Literal>FileLock</Literal> and <Literal>pid</Literal> is the <Literal>ProcessID</Literal> of the
-process holding the blocking <Literal>FileLock</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setLock :: Fd -&#62; FileLock -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setLock fd lock</Literal> calls <Function>fcntl</Function> with <Constant>F&lowbar;SETLK</Constant> to set or
-clear a lock segment for <Literal>Fd</Literal> <Literal>fd</Literal> as indicated by the
-<Literal>FileLock</Literal> <Literal>lock</Literal>.  <Function>setLock</Function> does not block, but fails with
-<Literal>SystemError</Literal> if the request cannot be satisfied immediately.
-</Para>
-
-<Para>
-
-<ProgramListing>
-waitToSetLock :: Fd -&#62; FileLock -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>waitToSetLock fd lock</Literal> calls <Function>fcntl</Function> with <Constant>F&lowbar;SETLKW</Constant> to set
-or clear a lock segment for <Literal>Fd</Literal> <Literal>fd</Literal> as indicated by the
-<Literal>FileLock</Literal> <Literal>lock</Literal>. If the request cannot be satisfied
-immediately, <Function>waitToSetLock</Function> blocks until the request can be
-satisfied.
-</Para>
-
-<Para>
-
-<ProgramListing>
-fdSeek :: Fd -&#62; SeekMode -&#62; FileOffset -&#62; IO FileOffset
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>fdSeek fd whence offset</Literal> calls <Function>lseek</Function> to position the
-<Literal>Fd</Literal> <Literal>fd</Literal> at the given <Literal>offset</Literal> from the starting location
-indicated by <Literal>whence</Literal>.  It returns the resulting offset from the
-start of the file in bytes.
-</Para>
-
-</Sect2>
-
-<Sect2 id="Device-Specific-Functions">
-<Title>Posix, Device- and Class-Specific Functions
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, device and class-specific functions</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-terminalMode    :: TerminalMode -&#62; TerminalAttributes -&#62; Bool
-withMode        :: TerminalAttributes -&#62; TerminalMode -&#62; TerminalAttributes
-withoutMode     :: TerminalAttributes -&#62; TerminalMode -&#62; TerminalAttributes
-
-bitsPerByte     :: TerminalAttributes -&#62; Int
-withBits        :: TerminalAttributes -&#62; Int -&#62; TerminalAttributes
-
-controlChar     :: TerminalAttributes -&#62; ControlCharacter -&#62; Maybe Char
-withCC          :: TerminalAttributes
-                -&#62; (ControlCharacter, Char)
-                -&#62; TerminalAttributes 
-withoutCC       :: TerminalAttributes 
-                -&#62; ControlCharacter 
-                -&#62; TerminalAttributes
-                  
-inputTime       :: TerminalAttributes -&#62; Int
-withTime        :: TerminalAttributes -&#62; Int -&#62; TerminalAttributes
-                  
-minInput        :: TerminalAttributes -&#62; Int
-withMinInput    :: TerminalAttributes -&#62; Int -&#62; TerminalAttributes
-                  
-inputSpeed      :: TerminalAttributes -&#62; BaudRate
-withInputSpeed  :: TerminalAttributes -&#62; BaudRate -&#62; TerminalAttributes
-                  
-outputSpeed     :: TerminalAttributes -&#62; BaudRate
-withOutputSpeed :: TerminalAttributes -&#62; BaudRate -&#62; TerminalAttributes
-
-getTerminalAttributes :: Fd -&#62; IO TerminalAttributes
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getTerminalAttributes fd</Literal> calls <Function>tcgetattr</Function> to obtain
-the <Literal>TerminalAttributes</Literal> associated with <Literal>Fd</Literal> <Literal>fd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setTerminalAttributes :: Fd
-                      -&#62; TerminalAttributes 
-                      -&#62; TerminalState
-                      -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setTerminalAttributes fd attr ts</Literal> calls <Function>tcsetattr</Function> to change
-the <Literal>TerminalAttributes</Literal> associated with <Literal>Fd</Literal> <Literal>fd</Literal> to
-<Literal>attr</Literal>, when the terminal is in the state indicated by <Literal>ts</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-sendBreak :: Fd -&#62; Int -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>sendBreak fd duration</Literal> calls <Function>tcsendbreak</Function> to transmit a
-continuous stream of zero-valued bits on <Literal>Fd</Literal> <Literal>fd</Literal> for the
-specified implementation-dependent <Literal>duration</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-drainOutput :: Fd -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>drainOutput fd</Literal> calls <Function>tcdrain</Function> to block until all output
-written to <Literal>Fd</Literal> <Literal>fd</Literal> has been transmitted.
-</Para>
-
-<Para>
-
-<ProgramListing>
-discardData :: Fd -&#62; QueueSelector -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>discardData fd queues</Literal> calls <Function>tcflush</Function> to discard
-pending input and/or output for <Literal>Fd</Literal> <Literal>fd</Literal>,
-as indicated by the <Literal>QueueSelector</Literal> <Literal>queues</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-controlFlow :: Fd -&#62; FlowAction -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>controlFlow fd action</Literal> calls <Function>tcflow</Function> to control the 
-flow of data on <Literal>Fd</Literal> <Literal>fd</Literal>, as indicated by
-<Literal>action</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-getTerminalProcessGroupID :: Fd -&#62; IO ProcessGroupID
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getTerminalProcessGroupID fd</Literal> calls <Function>tcgetpgrp</Function> to
-obtain the <Literal>ProcessGroupID</Literal> of the foreground process group 
-associated with the terminal attached to <Literal>Fd</Literal> <Literal>fd</Literal>.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setTerminalProcessGroupID :: Fd -&#62; ProcessGroupID -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setTerminalProcessGroupID fd pgid</Literal> calls <Function>tcsetpgrp</Function> to
-set the <Literal>ProcessGroupID</Literal> of the foreground process group 
-associated with the terminal attached to <Literal>Fd</Literal> 
-<Literal>fd</Literal> to <Literal>pgid</Literal>.
-</Para>
-
-</Sect2>
-
-<Sect2 id="System-Database">
-<Title>Posix System Databases
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, system databases</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-groupName    :: GroupEntry -&#62; String
-groupID      :: GroupEntry -&#62; GroupID
-groupMembers :: GroupEntry -&#62; [String]
-
-getGroupEntryForID :: GroupID -&#62; IO GroupEntry
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getGroupEntryForID gid</Literal> calls <Function>getgrgid</Function> to obtain
-the <Literal>GroupEntry</Literal> information associated with <Literal>GroupID</Literal>
-<Literal>gid</Literal>.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-There is no group entry for the GroupID.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-getGroupEntryForName :: String -&#62; IO GroupEntry
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getGroupEntryForName name</Literal> calls <Function>getgrnam</Function> to obtain
-the <Literal>GroupEntry</Literal> information associated with the group called
-<Literal>name</Literal>.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-There is no group entry for the name.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-userName      :: UserEntry -&#62; String
-userID        :: UserEntry -&#62; UserID
-userGroupID   :: UserEntry -&#62; GroupID
-homeDirectory :: UserEntry -&#62; String
-userShell     :: UserEntry -&#62; String
-
-getUserEntryForID :: UserID -&#62; IO UserEntry
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getUserEntryForID gid</Literal> calls <Function>getpwuid</Function> to obtain
-the <Literal>UserEntry</Literal> information associated with <Literal>UserID</Literal>
-<Literal>uid</Literal>.
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-There is no user entry for the UserID.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-<Para>
-
-<ProgramListing>
-getUserEntryForName :: String -&#62; IO UserEntry
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>getUserEntryForName name</Literal> calls <Function>getpwnam</Function> to obtain
-the <Literal>UserEntry</Literal> information associated with the user login
-<Literal>name</Literal>.
-</Para>
-
-<Para>
-The operation may fail with:
-</Para>
-
-<Para>
-<VariableList>
-
-<VarListEntry>
-<Term><Literal>NoSuchThing</Literal></Term>
-<ListItem>
-<Para>
-There is no user entry for the name.
-</Para>
-</ListItem>
-</VarListEntry>
-</VariableList>
-</Para>
-
-</Sect2>
-
-<Sect2 id="Error-reporting-and-handling">
-<Title>POSIX Errors
-</Title>
-
-<Para>
-<IndexTerm><Primary>Posix, errors</Primary></IndexTerm>
-</Para>
-
-<Para>
-
-<ProgramListing>
-getErrorCode :: IO ErrorCode
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Function>getErrorCode</Function> returns the current value of the external
-variable <Function>errno</Function>.  It never fails.
-</Para>
-
-<Para>
-
-<ProgramListing>
-setErrorCode :: ErrorCode -&#62; IO ()
-</ProgramListing>
-
-</Para>
-
-<Para>
-<Literal>setErrorCode err</Literal> sets the external
-variable <Function>errno</Function> to <Literal>err</Literal>.  It never fails.
-</Para>
-
-<Para>
-
-<ProgramListing>
-noError :: ErrorCode
-noError = 0
-
-argumentListTooLong, e2BIG              :: ErrorCode
-badFd, eBADF                            :: ErrorCode
-brokenPipe, ePIPE                       :: ErrorCode
-directoryNotEmpty, eNOTEMPTY            :: ErrorCode
-execFormatError, eNOEXEC                :: ErrorCode
-fileAlreadyExists, eEXIST               :: ErrorCode
-fileTooLarge, eFBIG                     :: ErrorCode
-filenameTooLong, eNAMETOOLONG           :: ErrorCode
-improperLink, eXDEV                     :: ErrorCode
-inappropriateIOControlOperation, eNOTTY :: ErrorCode
-inputOutputError, eIO                   :: ErrorCode
-interruptedOperation, eINTR             :: ErrorCode
-invalidArgument, eINVAL                 :: ErrorCode
-invalidSeek, eSPIPE                     :: ErrorCode
-isADirectory, eISDIR                    :: ErrorCode
-noChildProcess, eCHILD                  :: ErrorCode
-noLocksAvailable, eNOLCK                :: ErrorCode
-noSpaceLeftOnDevice, eNOSPC             :: ErrorCode
-noSuchOperationOnDevice, eNODEV         :: ErrorCode
-noSuchDeviceOrAddress, eNXIO            :: ErrorCode
-noSuchFileOrDirectory, eNOENT           :: ErrorCode
-noSuchProcess, eSRCH                    :: ErrorCode
-notADirectory, eNOTDIR                  :: ErrorCode
-notEnoughMemory, eNOMEM                 :: ErrorCode
-operationNotImplemented, eNOSYS         :: ErrorCode
-operationNotPermitted, ePERM            :: ErrorCode
-permissionDenied, eACCES                :: ErrorCode
-readOnlyFileSystem, eROFS               :: ErrorCode
-resourceBusy, eBUSY                     :: ErrorCode
-resourceDeadlockAvoided, eDEADLK        :: ErrorCode
-resourceTemporarilyUnavailable, eAGAIN  :: ErrorCode
-tooManyLinks, eMLINK                    :: ErrorCode
-tooManyOpenFiles, eMFILE                :: ErrorCode
-tooManyOpenFilesInSystem, eNFILE        :: ErrorCode
-</ProgramListing>
-
-</Para>
-
-</Sect2>
-
-</Sect1>
index 119034a..ce559d4 100644 (file)
         <!ENTITY glaexts        SYSTEM "glasgow_exts.sgml" >
         <!ENTITY parallel       SYSTEM "parallel.sgml" >
         <!ENTITY vs-hs          SYSTEM "vs_haskell.sgml" >
-        <!ENTITY libs           SYSTEM "libraries.sgml" >
-        <!ENTITY posix          SYSTEM "posix.sgml" >
-        <!ENTITY libmisc        SYSTEM "libmisc.sgml" >
         <!ENTITY wrong          SYSTEM "gone_wrong.sgml" >
+        <!ENTITY libraries      SYSTEM "libraries.sgml" >
         <!ENTITY utils          SYSTEM "utils.sgml" >
-        <!ENTITY mutablearray   SYSTEM "MutableArray.sgml">
-        <!ENTITY bytearray      SYSTEM "ByteArray.sgml">
         <!ENTITY win32-dll      SYSTEM "win32-dlls.sgml">
 ]>
 <Book>
@@ -36,8 +32,8 @@
 &prof
 &sooner
 &lang
-&libs
 &wrong
+&libraries
 &utils
 &win32-dll