feat(utils): throwLeftWith to facilitate ldap code
This commit is contained in:
parent
5f65e68b26
commit
8417eb57c9
@ -883,6 +883,11 @@ whenIsRight (Left _) _ = pure ()
|
||||
throwLeft :: (MonadThrow m, Exception exc) => Either exc a -> m a
|
||||
throwLeft = either throwM return
|
||||
|
||||
throwLeftWith :: (MonadThrow m, Exception e) => e -> Either b a -> m a
|
||||
-- throwLeftWith e = either (const $ throwM e) return
|
||||
throwLeftWith _ (Right x) = return x
|
||||
throwLeftWith e (Left _) = throwM e
|
||||
|
||||
{- Just a reminder for Steffen:
|
||||
mapLeft :: (a -> c) -> Either a b -> Either c b
|
||||
mapLeft = over _Left
|
||||
|
||||
Loading…
Reference in New Issue
Block a user