Skip to content

Commit

Permalink
tiny cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellwrosen committed Nov 28, 2023
1 parent 6102681 commit 0b1be3d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ki/src/Ki/Internal/Propagating.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ instance Exception Propagating where
pattern PropagatingFrom :: Tid -> SomeException
pattern PropagatingFrom childId <- (fromException -> Just Propagating {childId})

pattern PropagatingThe :: SomeException -> SomeException
pattern PropagatingThe exception <- (fromException -> Just Propagating {exception})

-- A unique identifier for a thread within a scope. (Internal type alias)
type Tid =
Int

-- Peel an outer Propagating layer off of some exception, if there is one.
peelOffPropagating :: SomeException -> SomeException
peelOffPropagating e0 =
case fromException e0 of
Just (Propagating _ e1) -> e1
Nothing -> e0
peelOffPropagating = \case
PropagatingThe exception -> exception
exception -> exception

-- @propagate exception child parent@ propagates @exception@ from @child@ to @parent@.
propagate :: SomeException -> Tid -> ThreadId -> IO ()
Expand Down

0 comments on commit 0b1be3d

Please sign in to comment.