Skip to content

Commit 1b7a692

Browse files
committed
Rename bracket condition labels
1 parent 5133c20 commit 1b7a692

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/Control/Monad/Aff.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,11 @@ function runFiber(util, suspended, aff, completeCb) {
507507
attempts = new Aff(CONS, new Aff(FINALIZED, step), attempts._2);
508508
status = CONTINUE;
509509
if (interrupt !== null) {
510-
step = attempt._1.kill(util.fromLeft(interrupt))(attempt._2);
510+
step = attempt._1.killed(util.fromLeft(interrupt))(attempt._2);
511511
} else if (fail !== null) {
512-
step = attempt._1.throw(util.fromLeft(fail))(attempt._2);
512+
step = attempt._1.failed(util.fromLeft(fail))(attempt._2);
513513
} else {
514-
step = attempt._1.release(attempt._2);
514+
step = attempt._1.completed(attempt._2);
515515
}
516516
break;
517517

src/Control/Monad/Aff.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ atomically a = bracket a (const (pure unit)) pure
246246
-- | acquisition nor disposal may be cancelled and are guaranteed to run until
247247
-- | they complete.
248248
bracket eff a b. Aff eff a (a Aff eff Unit) (a Aff eff b) Aff eff b
249-
bracket acquire release =
249+
bracket acquire completed =
250250
generalBracket acquire
251-
{ kill: const release
252-
, throw: const release
253-
, release
251+
{ killed: const completed
252+
, failed: const completed
253+
, completed
254254
}
255255

256256
foreign import _pure eff a. a Aff eff a
@@ -266,9 +266,9 @@ foreign import _parAffApply ∷ ∀ eff a b. ParAff eff (a → b) → ParAff eff
266266
foreign import _parAffAlt eff a. ParAff eff a ParAff eff a ParAff eff a
267267

268268
type BracketConditions eff a =
269-
{ kill Error a Aff eff Unit
270-
, throw Error a Aff eff Unit
271-
, release a Aff eff Unit
269+
{ killed Error a Aff eff Unit
270+
, failed Error a Aff eff Unit
271+
, completed a Aff eff Unit
272272
}
273273

274274
-- | A general purpose bracket

test/Test/Main.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ test_general_bracket = assert "bracket/general" do
235235
pure s
236236
bracketAction s =
237237
generalBracket (action s)
238-
{ kill: \error s' → void $ action (s' <> "/kill/" <> message error)
239-
, throw: \error s' → void $ action (s' <> "/throw/" <> message error)
240-
, release: \s' → void $ action (s' <> "/release")
238+
{ killed: \error s' → void $ action (s' <> "/kill/" <> message error)
239+
, failed: \error s' → void $ action (s' <> "/throw/" <> message error)
240+
, completed: \s' → void $ action (s' <> "/release")
241241
}
242242

243243
f1 ← forkAff $ bracketAction "foo" (const (action "a"))
@@ -322,9 +322,9 @@ test_kill_child = assert "kill/child" do
322322
let
323323
action s = generalBracket
324324
(modifyRef ref (_ <> "acquire" <> s))
325-
{ throw: \_ _ → modifyRef ref (_ <> "throw" <> s)
326-
, kill: \_ _ → modifyRef ref (_ <> "kill" <> s)
327-
, release: \_ → modifyRef ref (_ <> "complete" <> s)
325+
{ failed: \_ _ → modifyRef ref (_ <> "throw" <> s)
326+
, killed: \_ _ → modifyRef ref (_ <> "kill" <> s)
327+
, completed: \_ → modifyRef ref (_ <> "complete" <> s)
328328
}
329329
(\_ -> do
330330
delay (Milliseconds 10.0)

0 commit comments

Comments
 (0)