on master help sign in
Remove Errors
commitc7ef196b52e4b68fa4cf3069b02a2994157474fa authorAndrzej Rybczak <andrzej@rybczak.net> dateThu 8 Jul 2021, 23:55 (5 years ago) parent7ec9f1e
2 files changed+1−8
src/Effectful/Error.hs−7 tests/ErrorTests.hs+1−1
src/Effectful/Error.hs−7
@@ -21,7 +21,6 @@ For example, if you want to catch an unchecked exception like
2121-}
2222module Effectful.Error
2323 ( Error
24− , Errors
2524 , runError
2625 , throwError
2726 , catchError
@@ -29,7 +28,6 @@ module Effectful.Error
2928 ) where
3029
3130import Control.Exception
32−import Data.Kind
3331import Data.Typeable
3432import Data.Unique
3533import GHC.Stack
@@ -41,11 +39,6 @@ import Effectful.Internal.Monad
4139data Error e :: Effect where
4240 Error :: Unique -> Error e m r
4341
44−-- | Helper for multiple 'Error' effects.
45−type family Errors (errs :: [Type]) (es :: [Effect]) :: Constraint where
46− Errors '[] es = ()
47− Errors (err : errs) es = (Error err :> es, Errors errs es)
48−
4942-- | TODO: write about possibility of an error escaping the scope of 'runError'
5043-- when misused with 'AsyncE'.
5144runError
tests/ErrorTests.hs+1−1
@@ -31,5 +31,5 @@ data NestedErr :: Effect where
3131nestedErr :: (HasCallStack, NestedErr :> es) => Eff es ()
3232nestedErr = send NestedErr
3333
34−runNestedErr :: Errors '[String] es => Eff (NestedErr : es) a -> Eff es a
34+runNestedErr :: Error String :> es => Eff (NestedErr : es) a -> Eff es a
3535runNestedErr = interpret $ \NestedErr -> throwError "nested error"