@@ -7,7 +7,6 @@ module Effectful.Error.Dynamic
77 ) where
88
99import Data.Typeable
10−import GHC.Stack
1110
1211import Effectful.Handler
1312import Effectful.Monad
@@ -15,12 +14,12 @@ import qualified Effectful.Error as E
1514
1615data Error e :: Effect where
1716 ThrowError :: e -> Error e m a
18− CatchError :: m a -> (CallStack -> e -> m a) -> Error e m a
17+ CatchError :: m a -> (E.CallStack -> e -> m a) -> Error e m a
1918
2019runError
2120 :: Typeable e
2221 => Eff (Error e : es) a
23− -> Eff es (Either (CallStack, e) a)
22+ -> Eff es (Either (E.CallStack, e) a)
2423runError = reinterpretM E.runError $ \env -> \case
2524 ThrowError e -> E.throwError e
2625 CatchError m h -> localSeqUnlift env $ \unlift -> do
@@ -33,14 +32,14 @@ throwError
3332throwError = send . ThrowError
3433
3534catchError
36− :: Error e :> es
35+ :: (HasCallStack, Error e :> es)
3736 => Eff es a
38− -> (CallStack -> e -> Eff es a)
37+ -> (E.CallStack -> e -> Eff es a)
3938 -> Eff es a
4039catchError m = send . CatchError m
4140
4241tryError
43− :: Error e :> es
42+ :: (HasCallStack, Error e :> es)
4443 => Eff es a
45− -> Eff es (Either (CallStack, e) a)
44+ -> Eff es (Either (E.CallStack, e) a)
4645tryError m = (Right <$> m) `catchError` \es e -> pure $ Left (es, e)