module Control.Effect.Throw
(
Throw(..)
, throwError
, liftEither
, Algebra
, Has
, run
) where
import Control.Algebra
import Control.Effect.Throw.Internal (Throw(..))
throwError :: Has (Throw e) sig m => e -> m a
throwError :: forall e (sig :: (* -> *) -> * -> *) (m :: * -> *) a.
Has (Throw e) sig m =>
e -> m a
throwError = forall (eff :: (* -> *) -> * -> *) (sig :: (* -> *) -> * -> *)
(m :: * -> *) a.
(Member eff sig, Algebra sig m) =>
eff m a -> m a
send forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall e (m :: * -> *) a. e -> Throw e m a
Throw
{-# INLINE throwError #-}
liftEither :: Has (Throw e) sig m => Either e a -> m a
liftEither :: forall e (sig :: (* -> *) -> * -> *) (m :: * -> *) a.
Has (Throw e) sig m =>
Either e a -> m a
liftEither = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall e (sig :: (* -> *) -> * -> *) (m :: * -> *) a.
Has (Throw e) sig m =>
e -> m a
throwError forall (m :: * -> *) a. Monad m => a -> m a
return