{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Imp.Extra.Exception where

import qualified Control.Monad.Catch as Exception
import qualified Data.Maybe as Maybe

isType :: forall e. (Exception.Exception e) => Exception.SomeException -> Bool
isType :: forall e. Exception e => SomeException -> Bool
isType = Maybe e -> Bool
forall a. Maybe a -> Bool
Maybe.isJust (Maybe e -> Bool)
-> (SomeException -> Maybe e) -> SomeException -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall e. Exception e => SomeException -> Maybe e
Exception.fromException @e