X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FException.hs;h=1b299132533b1e894702da51762b5f2011c6e160;hb=328a2c4f748e81a1e613e2de48ebe86cfff60c67;hp=440197695db1b5a041481440738b577ecd717215;hpb=ddc4d9eb73b82fac60529f7d0646f2d7fc5e76e1;p=ghc-base.git diff --git a/Control/Exception.hs b/Control/Exception.hs index 4401976..1b29913 100644 --- a/Control/Exception.hs +++ b/Control/Exception.hs @@ -35,17 +35,20 @@ module Control.Exception ( #else SomeException(..), #endif - Exception(..), -- instance Eq, Ord, Show, Typeable - IOException, -- instance Eq, Ord, Show, Typeable - ArithException(..), -- instance Eq, Ord, Show, Typeable - ArrayException(..), -- instance Eq, Ord, Show, Typeable + Exception(..), -- class + IOException, -- instance Eq, Ord, Show, Typeable, Exception + ArithException(..), -- instance Eq, Ord, Show, Typeable, Exception + ArrayException(..), -- instance Eq, Ord, Show, Typeable, Exception AssertionFailed(..), - AsyncException(..), -- instance Eq, Ord, Show, Typeable + AsyncException(..), -- instance Eq, Ord, Show, Typeable, Exception #if __GLASGOW_HASKELL__ || __HUGS__ NonTermination(..), NestedAtomically(..), #endif +#ifdef __NHC__ + System.ExitCode(), -- instance Exception +#endif BlockedOnDeadMVar(..), BlockedIndefinitely(..), @@ -73,9 +76,7 @@ module Control.Exception ( -- ** The @catch@ functions catch, -- :: IO a -> (Exception -> IO a) -> IO a -#if __GLASGOW_HASKELL__ || __HUGS__ catches, Handler(..), -#endif catchJust, -- :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a -- ** The @handle@ functions @@ -137,7 +138,10 @@ import Data.Maybe import Prelude hiding (catch) #endif -#if __GLASGOW_HASKELL__ || __HUGS__ +#ifdef __NHC__ +import System (ExitCode()) +#endif + data Handler a = forall e . Exception e => Handler (e -> IO a) catches :: IO a -> [Handler a] -> IO a @@ -149,7 +153,6 @@ catchesHandler handlers e = foldr tryHandler (throw e) handlers = case fromException e of Just e' -> handler e' Nothing -> res -#endif -- ----------------------------------------------------------------------------- -- Asynchronous exceptions