Created
February 3, 2021 03:20
-
-
Save tylerjl/4532439a116ed694e68a61104e45ff02 to your computer and use it in GitHub Desktop.
Experimenting with pluck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
couldFail :: (MonadHttp m, OneOf err '[A, B]) => ExceptT err m [Key SomeEntity] | |
handleStuff :: Handler () | |
handleStuff = do | |
result <- runExceptT $ do | |
action <- catchOneT (catchOneT couldFail | |
\(A _) -> $(logWarn) "Handling an A failure" >> pure mempty) | |
\(B _) -> $(logWarn) "Handling a B failure" >> pure mempty | |
return action | |
case result of | |
Left _noMoreErrsHereIGuess -> do | |
setMessage $ text $ "There were failures" | |
redirect HomeR | |
Right _thisCouldBeEmptyBecauesFailure -> do | |
redirect HomeR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment