module Ki.ScopeClosing
  ( ScopeClosing (..),
  )
where

import Control.Exception (Exception (..), asyncExceptionFromException, asyncExceptionToException)
import Ki.Prelude

-- | Exception thrown by a parent __thread__ to its children when the __scope__ is closing.
data ScopeClosing
  = ScopeClosing
  deriving stock (ScopeClosing -> ScopeClosing -> Bool
(ScopeClosing -> ScopeClosing -> Bool)
-> (ScopeClosing -> ScopeClosing -> Bool) -> Eq ScopeClosing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScopeClosing -> ScopeClosing -> Bool
$c/= :: ScopeClosing -> ScopeClosing -> Bool
== :: ScopeClosing -> ScopeClosing -> Bool
$c== :: ScopeClosing -> ScopeClosing -> Bool
Eq, Int -> ScopeClosing -> ShowS
[ScopeClosing] -> ShowS
ScopeClosing -> String
(Int -> ScopeClosing -> ShowS)
-> (ScopeClosing -> String)
-> ([ScopeClosing] -> ShowS)
-> Show ScopeClosing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScopeClosing] -> ShowS
$cshowList :: [ScopeClosing] -> ShowS
show :: ScopeClosing -> String
$cshow :: ScopeClosing -> String
showsPrec :: Int -> ScopeClosing -> ShowS
$cshowsPrec :: Int -> ScopeClosing -> ShowS
Show)

instance Exception ScopeClosing where
  toException :: ScopeClosing -> SomeException
toException = ScopeClosing -> SomeException
forall e. Exception e => e -> SomeException
asyncExceptionToException
  fromException :: SomeException -> Maybe ScopeClosing
fromException = SomeException -> Maybe ScopeClosing
forall e. Exception e => SomeException -> Maybe e
asyncExceptionFromException