[project @ 2002-08-30 13:00:31 by simonpj]
[ghc-base.git] / GHC / IOBase.lhs
index 975bc79..5f84206 100644 (file)
@@ -17,6 +17,8 @@
 module GHC.IOBase where
 
 import GHC.ST
+import GHC.Arr -- to derive Ix class
+import GHC.Enum -- to derive Enum class
 import GHC.STRef
 import GHC.Base
 import GHC.Num -- To get fromInteger etc, needed because of -fno-implicit-prelude
@@ -445,7 +447,7 @@ showHandle p h duplex =
 -- |The type of exceptions.  Every kind of system-generated exception
 -- has a constructor in the 'Exception' type, and values of other
 -- types may be injected into 'Exception' by coercing them to
--- 'Dynamic' (see the section on Dynamic Exceptions).
+-- 'Dynamic' (see the section on Dynamic Exceptions: "Control.Exception\#DynamicExceptions").
 --
 -- For backwards compatibility with Haskell 98, 'IOError' is a type synonym
 -- for 'Exception'.
@@ -464,7 +466,7 @@ data Exception
        -- fails.  The 'String' argument contains the
        -- location of the assertion in the source program.
   | AsyncException     AsyncException
-       -- ^Asynchronous exceptions (see section on Asynchronous Exceptions).
+       -- ^Asynchronous exceptions (see section on Asynchronous Exceptions: "Control.Exception\#AsynchronousExceptions").
   | BlockedOnDeadMVar
        -- ^The current thread was executing a call to
        -- 'takeMVar' that could never return, because there are no other
@@ -474,7 +476,7 @@ data Exception
        -- deadlocked.  The 'Deadlock' exception is
        -- raised in the main thread only (see also: "Control.Concurrent").
   | DynException       Dynamic
-       -- ^Dynamically typed exceptions (see section on Dynamic Exceptions).
+       -- ^Dynamically typed exceptions (see section on Dynamic Exceptions: "Control.Exception\#DynamicExceptions").
   | ErrorCall          String
        -- ^The 'ErrorCall' exception is thrown by 'error'.  The 'String'
        -- argument of 'ErrorCall' is the string passed to 'error' when it was
@@ -772,4 +774,10 @@ instance Show IOException where
       (case fn of
         Nothing -> id
         Just name -> showString "\nFile: " . showString name)
+
+-- -----------------------------------------------------------------------------
+-- IOMode type
+
+data IOMode      =  ReadMode | WriteMode | AppendMode | ReadWriteMode
+                    deriving (Eq, Ord, Ix, Enum, Read, Show)
 \end{code}