@@ -18,7 +18,6 @@ import GHC.Stack
1818import Effectful.Internal.Effect
1919import Effectful.Internal.Env
2020import Effectful.Internal.Monad
21−import Effectful.Internal.Utils
2221
2322data Error e :: Effect where
2423 Error :: Unique -> Error e m r
@@ -28,7 +27,7 @@ data Error e :: Effect where
2827runError
2928 :: forall e es a. Typeable e
3029 => Eff (Error e : es) a
31− -> Eff es (Either ([String], e) a)
30+ -> Eff es (Either (CallStack, e) a)
3231runError (Eff m) = unsafeEff $ \es0 -> mask $ \release -> do
3332 -- A unique tag is picked so that different runError handlers for the same
3433 -- type don't catch each other's exceptions.
@@ -44,12 +43,12 @@ throwError
4443 => e
4544 -> Eff es a
4645throwError e = readerEffectM @(Error e) $ \(IdE (Error tag)) -> unsafeEff_ $ do
47− throwIO $ WrapErr tag (ppCallStack <$> getCallStack callStack) e
46+ throwIO $ WrapErr tag callStack e
4847
4948catchError
5049 :: forall e es a. (Typeable e, Error e :> es)
5150 => Eff es a
52− -> ([String] -> e -> Eff es a)
51+ -> (CallStack -> e -> Eff es a)
5352 -> Eff es a
5453catchError (Eff m) handler = do
5554 readerEffectM @(Error e) $ \(IdE (Error tag)) -> unsafeEff $ \es -> do
@@ -61,13 +60,13 @@ catchError (Eff m) handler = do
6160tryError
6261 :: forall e es a. (Typeable e, Error e :> es)
6362 => Eff es a
64− -> Eff es (Either ([String], e) a)
63+ -> Eff es (Either (CallStack, e) a)
6564tryError m = (Right <$> m) `catchError` \es e -> pure $ Left (es, e)
6665
6766----------------------------------------
6867-- Helpers
6968
70−data WrapErr e = WrapErr Unique [String] e
69+data WrapErr e = WrapErr Unique CallStack e
7170
7271instance Typeable e => Show (WrapErr e) where
7372 showsPrec p (WrapErr _ cs e)
@@ -77,12 +76,12 @@ instance Typeable e => Show (WrapErr e) where
7776 . showsPrec p cs
7877instance Typeable e => Exception (WrapErr e)
7978
80−catchErrorIO :: Typeable e => Unique -> IO a -> ([String] -> e -> IO a) -> IO a
79+catchErrorIO :: Typeable e => Unique -> IO a -> (CallStack -> e -> IO a) -> IO a
8180catchErrorIO tag m handler = do
8281 m `catch` \err@(WrapErr etag e cs) -> do
8382 if tag == etag
8483 then handler e cs
8584 else throwIO err
8685
87−tryErrorIO :: Typeable e => Unique -> IO a -> IO (Either ([String], e) a)
86+tryErrorIO :: Typeable e => Unique -> IO a -> IO (Either (CallStack, e) a)
8887tryErrorIO tag m = catchErrorIO tag (Right <$> m) $ \es e -> pure $ Left (es, e)