module Web.Scim.Handler
( ScimHandler,
throwScim,
fromScimHandler,
)
where
import Control.Monad ((<=<))
import Control.Monad.Except
import Web.Scim.Schema.Error
type ScimHandler m = ExceptT ScimError m
throwScim :: (Monad m) => ScimError -> ScimHandler m a
throwScim :: forall (m :: * -> *) a. Monad m => ScimError -> ScimHandler m a
throwScim = ScimError -> ExceptT ScimError m a
forall a. ScimError -> ExceptT ScimError m a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError
fromScimHandler ::
(Monad m) =>
(forall a. ScimError -> m a) ->
(forall a. ScimHandler m a -> m a)
fromScimHandler :: forall (m :: * -> *).
Monad m =>
(forall a. ScimError -> m a) -> forall a. ScimHandler m a -> m a
fromScimHandler forall a. ScimError -> m a
fromError = (ScimError -> m a) -> (a -> m a) -> Either ScimError a -> m a
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either ScimError -> m a
forall a. ScimError -> m a
fromError a -> m a
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Either ScimError a -> m a)
-> (ScimHandler m a -> m (Either ScimError a))
-> ScimHandler m a
-> m a
forall (m :: * -> *) b c a.
Monad m =>
(b -> m c) -> (a -> m b) -> a -> m c
<=< ScimHandler m a -> m (Either ScimError a)
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT