Skip to content

Commit b9c9d34

Browse files
committed
Put 'finally' directly underneath 'later'.
1 parent 2966912 commit b9c9d34

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Control/Monad/Aff.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ module Control.Monad.Aff
9090
later' :: forall e a. Number -> Aff e a -> Aff e a
9191
later' n aff = runFn3 _setTimeout nonCanceler n aff
9292

93+
-- | Compute `aff1`, followed by `aff2` regardless of whether `aff1` terminated successfully.
94+
finally :: forall e a b. Aff e a -> Aff e b -> Aff e a
95+
finally aff1 aff2 = do
96+
x <- attempt aff1
97+
aff2
98+
either throwError pure x
99+
93100
-- | Forks the specified asynchronous computation so subsequent computations
94101
-- | will not block on the result of the computation.
95102
-- |
@@ -106,13 +113,6 @@ module Control.Monad.Aff
106113
apathize :: forall e a. Aff e a -> Aff e Unit
107114
apathize a = const unit <$> attempt a
108115

109-
-- | Compute `aff1`, followed by `aff2` regardless of whether `aff1` terminated successfully.
110-
finally :: forall e a b. Aff e a -> Aff e b -> Aff e a
111-
finally aff1 aff2 = do
112-
x <- attempt aff1
113-
aff2
114-
either throwError pure x
115-
116116
-- | Lifts a synchronous computation and makes explicit any failure from exceptions.
117117
liftEff' :: forall e a. Eff (err :: Exception | e) a -> Aff e (Either Error a)
118118
liftEff' eff = attempt (_unsafeInterleaveAff (runFn2 _liftEff nonCanceler eff))

0 commit comments

Comments
 (0)