From 0b1be3d96496e6bf98acaf721e661ec1a8a3643c Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Mon, 27 Nov 2023 21:50:58 -0500 Subject: [PATCH] tiny cleanup --- ki/src/Ki/Internal/Propagating.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ki/src/Ki/Internal/Propagating.hs b/ki/src/Ki/Internal/Propagating.hs index 8ef0889..1b9a113 100644 --- a/ki/src/Ki/Internal/Propagating.hs +++ b/ki/src/Ki/Internal/Propagating.hs @@ -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 ()