module Control.Exception ( #ifdef __HUGS__ SomeException, #else SomeException(..), #endif Exception(..), IOException, ArithException(..), ArrayException(..), AssertionFailed(..), AsyncException(..), #if __GLASGOW_HASKELL__ || __HUGS__ NonTermination(..), NestedAtomically(..), #endif #ifdef __NHC__ System.ExitCode(), #endif BlockedIndefinitelyOnMVar(..), BlockedIndefinitelyOnSTM(..), Deadlock(..), NoMethodError(..), PatternMatchFail(..), RecConError(..), RecSelError(..), RecUpdError(..), ErrorCall(..), throw, throwIO, ioError, #ifdef __GLASGOW_HASKELL__ throwTo, #endif catch, catches, Handler(..), catchJust, handle, handleJust, try, tryJust, evaluate, mapException, mask, #ifndef __NHC__ mask_, uninterruptibleMask, uninterruptibleMask_, MaskingState(..), getMaskingState, allowInterrupt, #endif block, unblock, blocked, assert, bracket, bracket_, bracketOnError, finally, onException, ) where import Control.Exception.Base #ifdef __GLASGOW_HASKELL__ import GHC.Base import GHC.IO (unsafeUnmask) import Data.Maybe #else import Prelude hiding (catch) #endif #ifdef __NHC__ import System (ExitCode()) #endif data Handler a = forall e . Exception e => Handler (e -> IO a) instance Functor Handler where fmap f (Handler h) = Handler (fmap f . h) catches :: IO a -> [Handler a] -> IO a catches io handlers = io `catch` catchesHandler handlers catchesHandler :: [Handler a] -> SomeException -> IO a catchesHandler handlers e = foldr tryHandler (throw e) handlers where tryHandler (Handler handler) res = case fromException e of Just e' -> handler e' Nothing -> res allowInterrupt :: IO () allowInterrupt = unsafeUnmask $ return ()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4