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
-- |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'.
-- 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
-- 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
(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}