moduleSystem.OsString.Internal.ExceptionwhereimportControl.Exception(catch,fromException,toException,throwIO,Exception,SomeAsyncException(..))-- | Like 'try', but rethrows async exceptions.trySafe ::Exceptione =>IOa ->IO(Eithere a )trySafe :: forall e a. Exception e => IO a -> IO (Either e a) trySafe IO a ioA =IO (Either e a) -> (e -> IO (Either e a)) -> IO (Either e a) forall e a. Exception e => IO a -> (e -> IO a) -> IO a catchIO (Either e a) forall {a}. IO (Either a a) action e -> IO (Either e a) forall {a} {b}. Exception a => a -> IO (Either a b) eHandler whereaction :: IO (Either a a) action =doa v <-IO a ioA Either a a -> IO (Either a a) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return(a -> Either a a forall a b. b -> Either a b Righta v )eHandler :: a -> IO (Either a b) eHandler a e |a -> Bool forall e. Exception e => e -> Bool isAsyncException a e =a -> IO (Either a b) forall e a. Exception e => e -> IO a throwIOa e |Bool otherwise=Either a b -> IO (Either a b) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return(a -> Either a b forall a b. a -> Either a b Lefta e )isAsyncException ::Exceptione =>e ->BoolisAsyncException :: forall e. Exception e => e -> Bool isAsyncException e e =caseSomeException -> Maybe SomeAsyncException forall e. Exception e => SomeException -> Maybe e fromException(e -> SomeException forall e. Exception e => e -> SomeException toExceptione e )ofJust(SomeAsyncExceptione _)->Bool TrueMaybe SomeAsyncException Nothing->Bool False