@@ -33,7 +33,7 @@ readRef = liftEffect <<< Ref.read
3333writeRef ∷ ∀ m a . MonadEffect m ⇒ Ref a → a → m Unit
3434writeRef r = liftEffect <<< flip Ref .write r
3535
36- modifyRef ∷ ∀ m a . MonadEffect m ⇒ Ref a → (a → a ) → m Unit
36+ modifyRef ∷ ∀ m a . MonadEffect m ⇒ Ref a → (a → a ) → m a
3737modifyRef r = liftEffect <<< flip Ref .modify r
3838
3939assertEff ∷ String → Either Error Boolean → Effect Unit
@@ -102,19 +102,19 @@ test_fork = assert "fork" do
102102 fiber ← forkAff do
103103 delay (Milliseconds 10.0 )
104104 modifyRef ref (_ <> " child" )
105- modifyRef ref (_ <> " go" )
105+ _ ← modifyRef ref (_ <> " go" )
106106 delay (Milliseconds 20.0 )
107- modifyRef ref (_ <> " parent" )
107+ _ ← modifyRef ref (_ <> " parent" )
108108 eq " gochildparent" <$> readRef ref
109109
110110test_join ∷ Aff Unit
111111test_join = assert " join" do
112112 ref ← newRef " "
113113 fiber ← forkAff do
114114 delay (Milliseconds 10.0 )
115- modifyRef ref (_ <> " child" )
115+ _ ← modifyRef ref (_ <> " child" )
116116 readRef ref
117- modifyRef ref (_ <> " parent" )
117+ _ ← modifyRef ref (_ <> " parent" )
118118 eq " parentchild" <$> joinFiber fiber
119119
120120test_join_throw ∷ Aff Unit
@@ -134,11 +134,11 @@ test_multi_join = assert "join/multi" do
134134 ref ← newRef 1
135135 f1 ← forkAff do
136136 delay (Milliseconds 10.0 )
137- modifyRef ref (_ + 1 )
137+ _ ← modifyRef ref (_ + 1 )
138138 pure 10
139139 f2 ← forkAff do
140140 delay (Milliseconds 20.0 )
141- modifyRef ref (_ + 1 )
141+ _ ← modifyRef ref (_ + 1 )
142142 pure 20
143143 n1 ← traverse joinFiber
144144 [ f1
@@ -155,9 +155,9 @@ test_suspend = assert "suspend" do
155155 fiber ← suspendAff do
156156 delay (Milliseconds 10.0 )
157157 modifyRef ref (_ <> " child" )
158- modifyRef ref (_ <> " go" )
158+ _ ← modifyRef ref (_ <> " go" )
159159 delay (Milliseconds 20.0 )
160- modifyRef ref (_ <> " parent" )
160+ _ ← modifyRef ref (_ <> " parent" )
161161 _ ← joinFiber fiber
162162 eq " goparentchild" <$> readRef ref
163163
@@ -185,7 +185,7 @@ test_bracket = assert "bracket" do
185185 let
186186 action s = do
187187 delay (Milliseconds 10.0 )
188- modifyRef ref (_ <> [ s ])
188+ _ ← modifyRef ref (_ <> [ s ])
189189 pure s
190190 fiber ← forkAff do
191191 delay (Milliseconds 40.0 )
@@ -206,7 +206,7 @@ test_bracket_nested = assert "bracket/nested" do
206206 let
207207 action s = do
208208 delay (Milliseconds 10.0 )
209- modifyRef ref (_ <> [ s ])
209+ _ ← modifyRef ref (_ <> [ s ])
210210 pure s
211211 bracketAction s =
212212 bracket
@@ -235,7 +235,7 @@ test_general_bracket = assert "bracket/general" do
235235 let
236236 action s = do
237237 delay (Milliseconds 10.0 )
238- modifyRef ref (_ <> s)
238+ _ ← modifyRef ref (_ <> s)
239239 pure s
240240 bracketAction s =
241241 generalBracket (action s)
@@ -265,13 +265,13 @@ test_supervise = assert "supervise" do
265265 _ ← forkAff do
266266 bracket
267267 (modifyRef ref (_ <> " acquire" ))
268- (\_ → modifyRef ref (_ <> " release" ))
268+ (\_ → void $ modifyRef ref (_ <> " release" ))
269269 (\_ → delay (Milliseconds 10.0 ))
270270 _ ← forkAff do
271271 delay (Milliseconds 11.0 )
272- modifyRef ref (_ <> " delay" )
272+ void $ modifyRef ref (_ <> " delay" )
273273 delay (Milliseconds 5.0 )
274- modifyRef ref (_ <> " done" )
274+ _ ← modifyRef ref (_ <> " done" )
275275 pure " done"
276276 delay (Milliseconds 20.0 )
277277 r2 ← readRef ref
@@ -303,7 +303,7 @@ test_kill_bracket = assert "kill/bracket" do
303303 let
304304 action n = do
305305 delay (Milliseconds 10.0 )
306- modifyRef ref (_ <> n)
306+ void $ modifyRef ref (_ <> n)
307307 fiber ←
308308 forkAff $ bracket
309309 (action " a" )
@@ -320,7 +320,7 @@ test_kill_bracket_nested = assert "kill/bracket/nested" do
320320 let
321321 action s = do
322322 delay (Milliseconds 10.0 )
323- modifyRef ref (_ <> [ s ])
323+ _ ← modifyRef ref (_ <> [ s ])
324324 pure s
325325 bracketAction s =
326326 bracket
@@ -350,13 +350,13 @@ test_kill_supervise = assert "kill/supervise" do
350350 let
351351 action s = generalBracket
352352 (modifyRef ref (_ <> " acquire" <> s))
353- { failed: \_ _ → modifyRef ref (_ <> " throw" <> s)
354- , killed: \_ _ → modifyRef ref (_ <> " kill" <> s)
355- , completed: \_ _ → modifyRef ref (_ <> " complete" <> s)
353+ { failed: \_ _ → void $ modifyRef ref (_ <> " throw" <> s)
354+ , killed: \_ _ → void $ modifyRef ref (_ <> " kill" <> s)
355+ , completed: \_ _ → void $ modifyRef ref (_ <> " complete" <> s)
356356 }
357357 (\_ -> do
358358 delay (Milliseconds 10.0 )
359- modifyRef ref (_ <> " child" <> s))
359+ void $ modifyRef ref (_ <> " child" <> s))
360360 fiber ← forkAff $ supervise do
361361 _ ← forkAff $ action " foo"
362362 _ ← forkAff $ action " bar"
@@ -398,7 +398,7 @@ test_parallel = assert "parallel" do
398398 let
399399 action s = do
400400 delay (Milliseconds 10.0 )
401- modifyRef ref (_ <> s)
401+ _ ← modifyRef ref (_ <> s)
402402 pure s
403403 f1 ← forkAff $ sequential $
404404 { a: _, b: _ }
@@ -415,7 +415,7 @@ test_parallel_throw = assert "parallel/throw" $ withTimeout (Milliseconds 100.0)
415415 let
416416 action n s = do
417417 delay (Milliseconds n)
418- modifyRef ref (_ <> s)
418+ _ ← modifyRef ref (_ <> s)
419419 pure s
420420 r1 ← try $ sequential $
421421 { a: _, b: _ }
@@ -431,10 +431,10 @@ test_kill_parallel = assert "kill/parallel" do
431431 action s = do
432432 bracket
433433 (pure unit)
434- (\_ → modifyRef ref (_ <> " killed" <> s))
434+ (\_ → void $ modifyRef ref (_ <> " killed" <> s))
435435 (\_ → do
436436 delay (Milliseconds 10.0 )
437- modifyRef ref (_ <> s))
437+ void $ modifyRef ref (_ <> s))
438438 f1 ← forkAff $ sequential $
439439 parallel (action " foo" ) *> parallel (action " bar" )
440440 f2 ← forkAff do
@@ -451,7 +451,7 @@ test_parallel_alt = assert "parallel/alt" do
451451 let
452452 action n s = do
453453 delay (Milliseconds n)
454- modifyRef ref (_ <> s)
454+ _ ← modifyRef ref (_ <> s)
455455 pure s
456456 f1 ← forkAff $ sequential $
457457 parallel (action 10.0 " foo" ) <|> parallel (action 5.0 " bar" )
@@ -475,7 +475,7 @@ test_parallel_alt_sync = assert "parallel/alt/sync" do
475475 action s = do
476476 bracket
477477 (pure unit)
478- (\_ → modifyRef ref (_ <> " killed" <> s))
478+ (\_ → void $ modifyRef ref (_ <> " killed" <> s))
479479 (\_ → modifyRef ref (_ <> s) $> s)
480480 r1 ← sequential $
481481 parallel (action " foo" )
@@ -490,7 +490,7 @@ test_parallel_mixed = assert "parallel/mixed" do
490490 let
491491 action n s = parallel do
492492 delay (Milliseconds n)
493- modifyRef ref (_ <> s)
493+ _ ← modifyRef ref (_ <> s)
494494 pure s
495495 { r1, r2, r3 } ← sequential $
496496 { r1: _, r2: _, r3: _ }
@@ -512,10 +512,10 @@ test_kill_parallel_alt = assert "kill/parallel/alt" do
512512 action n s = do
513513 bracket
514514 (pure unit)
515- (\_ → modifyRef ref (_ <> " killed" <> s))
515+ (\_ → void $ modifyRef ref (_ <> " killed" <> s))
516516 (\_ → do
517517 delay (Milliseconds n)
518- modifyRef ref (_ <> s))
518+ void $ modifyRef ref (_ <> s))
519519 f1 ← forkAff $ sequential $
520520 parallel (action 10.0 " foo" ) <|> parallel (action 20.0 " bar" )
521521 f2 ← forkAff do
@@ -535,7 +535,7 @@ test_kill_parallel_alt_finalizer = assert "kill/parallel/alt/finalizer" do
535535 (pure unit)
536536 (\_ → do
537537 delay (Milliseconds 10.0 )
538- modifyRef ref (_ <> " killed" ))
538+ void $ modifyRef ref (_ <> " killed" ))
539539 (\_ → delay (Milliseconds 20.0 ))
540540 f2 ← forkAff do
541541 delay (Milliseconds 15.0 )
@@ -550,7 +550,7 @@ test_fiber_map = assert "fiber/map" do
550550 ref ← newRef 0
551551 let
552552 mapFn a = unsafePerformEffect do
553- Ref .modify (_ + 1 ) ref
553+ _ ← Ref .modify (_ + 1 ) ref
554554 pure (a + 1 )
555555 f1 ← forkAff do
556556 delay (Milliseconds 10.0 )
@@ -567,7 +567,7 @@ test_fiber_apply = assert "fiber/apply" do
567567 ref ← newRef 0
568568 let
569569 applyFn a b = unsafePerformEffect do
570- Ref .modify (_ + 1 ) ref
570+ _ ← Ref .modify (_ + 1 ) ref
571571 pure (a + b)
572572 f1 ← forkAff do
573573 delay (Milliseconds 10.0 )
@@ -592,7 +592,7 @@ test_efffn = assert "efffn" do
592592 runAff_ (either (AC .runEffectFn1 cke) (AC .runEffectFn1 ckc)) (killFiber e fiber)
593593 action = do
594594 effectDelay (Milliseconds 10.0 )
595- modifyRef ref (_ <> " done" )
595+ void $ modifyRef ref (_ <> " done" )
596596 f1 ← forkAff action
597597 f2 ← forkAff action
598598 killFiber (error " Nope." ) f2
0 commit comments