From 82c8a3a150bf6420e53e327806622e3119566b8f Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 5 Aug 2008 22:13:41 +0000 Subject: [PATCH] Move some internals around to simplify the import graph a bit --- GHC/Err.lhs | 1 - GHC/Exception.lhs | 30 ++++++++++++++++++++++++++++++ GHC/IOBase.lhs | 28 ---------------------------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/GHC/Err.lhs b/GHC/Err.lhs index 8c02f85..9a94ce0 100644 --- a/GHC/Err.lhs +++ b/GHC/Err.lhs @@ -34,7 +34,6 @@ module GHC.Err #ifndef __HADDOCK__ import GHC.Types -import GHC.IOBase import GHC.Exception #endif \end{code} diff --git a/GHC/Exception.lhs b/GHC/Exception.lhs index a285542..4707a0c 100644 --- a/GHC/Exception.lhs +++ b/GHC/Exception.lhs @@ -62,3 +62,33 @@ throw :: Exception e => e -> a throw e = raise# (toException e) \end{code} +\begin{code} +data ErrorCall = ErrorCall String + deriving Typeable + +instance Exception ErrorCall + +instance Show ErrorCall where + showsPrec _ (ErrorCall err) = showString err + +----- + +-- |The type of arithmetic exceptions +data ArithException + = Overflow + | Underflow + | LossOfPrecision + | DivideByZero + | Denormal + deriving (Eq, Ord, Typeable) + +instance Exception ArithException + +instance Show ArithException where + showsPrec _ Overflow = showString "arithmetic overflow" + showsPrec _ Underflow = showString "arithmetic underflow" + showsPrec _ LossOfPrecision = showString "loss of precision" + showsPrec _ DivideByZero = showString "divide by zero" + showsPrec _ Denormal = showString "denormal" + +\end{code} diff --git a/GHC/IOBase.lhs b/GHC/IOBase.lhs index 14316d2..9b4b0be 100644 --- a/GHC/IOBase.lhs +++ b/GHC/IOBase.lhs @@ -634,16 +634,6 @@ showHandle file = showString "{handle: " . showString file . showString "}" -- ------------------------------------------------------------------------ -- Exception datatypes and operations -data ErrorCall = ErrorCall String - deriving Typeable - -instance Exception ErrorCall - -instance Show ErrorCall where - showsPrec _ (ErrorCall err) = showString err - ------ - data BlockedOnDeadMVar = BlockedOnDeadMVar deriving Typeable @@ -684,17 +674,6 @@ instance Show AssertionFailed where ----- --- |The type of arithmetic exceptions -data ArithException - = Overflow - | Underflow - | LossOfPrecision - | DivideByZero - | Denormal - deriving (Eq, Ord, Typeable) - -instance Exception ArithException - -- |Asynchronous exceptions data AsyncException = StackOverflow @@ -740,13 +719,6 @@ stackOverflow, heapOverflow :: SomeException -- for the RTS stackOverflow = toException StackOverflow heapOverflow = toException HeapOverflow -instance Show ArithException where - showsPrec _ Overflow = showString "arithmetic overflow" - showsPrec _ Underflow = showString "arithmetic underflow" - showsPrec _ LossOfPrecision = showString "loss of precision" - showsPrec _ DivideByZero = showString "divide by zero" - showsPrec _ Denormal = showString "denormal" - instance Show AsyncException where showsPrec _ StackOverflow = showString "stack overflow" showsPrec _ HeapOverflow = showString "heap overflow" -- 1.7.10.4