We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
finally
1 parent 50107c3 commit 57a0cc2Copy full SHA for 57a0cc2
src/Control/Monad/Aff.purs
@@ -106,6 +106,13 @@ module Control.Monad.Aff
106
apathize :: forall e a. Aff e a -> Aff e Unit
107
apathize a = const unit <$> attempt a
108
109
+ -- | Compute `aff1`, followed by `aff2` regardless of whether `aff1` terminated successfully.
110
+ finally :: forall e a. Aff e a -> Aff e Unit -> Aff e a
111
+ finally aff1 aff2 = do
112
+ x <- attempt aff1
113
+ aff2
114
+ either throwError pure x
115
+
116
-- | Lifts a synchronous computation and makes explicit any failure from exceptions.
117
liftEff' :: forall e a. Eff (err :: Exception | e) a -> Aff e (Either Error a)
118
liftEff' eff = attempt (_unsafeInterleaveAff (runFn2 _liftEff nonCanceler eff))
0 commit comments