1[38;2;117;113;94m/*[0m 2[38;2;117;113;94m * Copyright (c) 2017-2019 The Typelevel Cats-effect Project Developers[0m 3[38;2;117;113;94m *[0m 4[38;2;117;113;94m * Licensed under the Apache License, Version 2.0 (the "License");[0m 5[38;2;117;113;94m * you may not use this file except in compliance with the License.[0m 6[38;2;117;113;94m * You may obtain a copy of the License at[0m 7[38;2;117;113;94m *[0m 8[38;2;117;113;94m * http://www.apache.org/licenses/LICENSE-2.0[0m 9[38;2;117;113;94m *[0m 10[38;2;117;113;94m * Unless required by applicable law or agreed to in writing, software[0m 11[38;2;117;113;94m * distributed under the License is distributed on an "AS IS" BASIS,[0m 12[38;2;117;113;94m * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.[0m 13[38;2;117;113;94m * See the License for the specific language governing permissions and[0m 14[38;2;117;113;94m * limitations under the License.[0m 15[38;2;117;113;94m */[0m 16 17[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mcats[0m 18[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46meffect[0m 19[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mlaws[0m 20 21[38;2;249;38;114mimport[0m[38;2;248;248;242m cats[0m[38;2;248;248;242m.[0m[38;2;248;248;242meffect[0m[38;2;248;248;242m.[0m[38;2;248;248;242mconcurrent[0m[38;2;248;248;242m.[0m[38;2;248;248;242mDeferred[0m 22[38;2;249;38;114mimport[0m[38;2;248;248;242m cats[0m[38;2;248;248;242m.[0m[38;2;248;248;242msyntax[0m[38;2;248;248;242m.[0m[38;2;248;248;242mall[0m[38;2;248;248;242m.[0m[38;2;255;255;255m_[0m 23[38;2;249;38;114mimport[0m[38;2;248;248;242m cats[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlaws[0m[38;2;248;248;242m.[0m[38;2;255;255;255m_[0m 24 25[38;2;249;38;114mimport[0m[38;2;248;248;242m scala[0m[38;2;248;248;242m.[0m[38;2;248;248;242mconcurrent[0m[38;2;248;248;242m.[0m[38;2;248;248;242mPromise[0m 26 27[3;38;2;102;217;239mtrait[0m[4;38;2;102;217;239m ConcurrentEffectLaws[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m[[0m[38;2;255;255;255m_[0m[38;2;248;248;242m][0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[3;4;38;2;166;226;46mConcurrentLaws[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114mwith[0m[38;2;248;248;242m [0m[3;4;38;2;166;226;46mEffectLaws[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 28[38;2;248;248;242m [0m[38;2;249;38;114mimplicit[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mF[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mConcurrentEffect[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m 29 30[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mrunAsyncRunCancelableCoherence[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m([0m[3;38;2;253;151;31mfa[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 31[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mfa1[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m.[0m[38;2;248;248;242masync[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcb[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m 32[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mrunAsync[0m[38;2;248;248;242m([0m[38;2;248;248;242mfa[0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mr[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m([0m[38;2;248;248;242mcb[0m[38;2;248;248;242m([0m[38;2;248;248;242mr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242munsafeRunSync[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m 33[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 34[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mfa2[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcb[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m 35[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtoIO[0m[38;2;248;248;242m([0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mrunCancelable[0m[38;2;248;248;242m([0m[38;2;248;248;242mfa[0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mr[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m([0m[38;2;248;248;242mcb[0m[38;2;248;248;242m([0m[38;2;248;248;242mr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242munsafeRunSync[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m 36[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 37[38;2;248;248;242m fa1 <-> fa2[0m 38[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 39 40[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mrunCancelableIsSynchronous[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 41[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mlh[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mDeferred[0m[38;2;248;248;242m.[0m[38;2;248;248;242muncancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mUnit[0m[38;2;248;248;242m][0m[38;2;248;248;242m.[0m[38;2;248;248;242mflatMap [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mlatch[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m 42[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mspawned[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mPromise[0m[38;2;248;248;242m[[0m[3;38;2;102;217;239mUnit[0m[38;2;248;248;242m][0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m 43[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Never ending task[0m 44[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mff[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m 45[38;2;248;248;242m spawned[0m[38;2;248;248;242m.[0m[38;2;248;248;242msuccess[0m[38;2;248;248;242m([0m[38;2;190;132;255m()[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m latch[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcomplete[0m[38;2;248;248;242m([0m[38;2;190;132;255m()[0m[38;2;248;248;242m)[0m 46[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 47[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Execute, then cancel[0m 48[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mtoken[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mdelay[0m[38;2;248;248;242m([0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mrunCancelable[0m[38;2;248;248;242m([0m[38;2;248;248;242mff[0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m.[0m[38;2;248;248;242munit[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242munsafeRunSync[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mflatMap [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcancel[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m 49[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Waiting for the task to start before cancelling it[0m 50[38;2;248;248;242m [0m[38;2;102;217;239mAsync[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfromFuture[0m[38;2;248;248;242m([0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mpure[0m[38;2;248;248;242m([0m[38;2;248;248;242mspawned[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfuture[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m >> cancel[0m 51[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 52[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mliftIO[0m[38;2;248;248;242m([0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mrunAsync[0m[38;2;248;248;242m([0m[38;2;248;248;242mtoken[0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m.[0m[38;2;248;248;242munit[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtoIO[0m[38;2;248;248;242m)[0m[38;2;248;248;242m *> latch[0m[38;2;248;248;242m.[0m[38;2;248;248;242mget[0m 53[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 54[38;2;248;248;242m lh <-> [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242munit[0m 55[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 56 57[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mrunCancelableStartCancelCoherence[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m([0m[3;38;2;253;151;31ma[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 58[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Cancellation via runCancelable[0m 59[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mf1[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 60[38;2;248;248;242m [0m[3;38;2;253;151;31meffect1[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mDeferred[0m[38;2;248;248;242m.[0m[38;2;248;248;242muncancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m 61[38;2;248;248;242m [0m[3;38;2;253;151;31mlatch[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mdelay[0m[38;2;248;248;242m([0m[38;2;102;217;239mPromise[0m[38;2;248;248;242m[[0m[3;38;2;102;217;239mUnit[0m[38;2;248;248;242m][0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m 62[38;2;248;248;242m [0m[3;38;2;253;151;31mnever[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m 63[38;2;248;248;242m latch[0m[38;2;248;248;242m.[0m[38;2;248;248;242msuccess[0m[38;2;248;248;242m([0m[38;2;190;132;255m()[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m effect1[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcomplete[0m[38;2;248;248;242m([0m[38;2;248;248;242ma[0m[38;2;248;248;242m)[0m 64[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 65[38;2;248;248;242m [0m[3;38;2;253;151;31mcancel[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mliftIO[0m[38;2;248;248;242m([0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mrunCancelable[0m[38;2;248;248;242m([0m[38;2;248;248;242mnever[0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;102;217;239mIO[0m[38;2;248;248;242m.[0m[38;2;248;248;242munit[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtoIO[0m[38;2;248;248;242m)[0m 66[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Waiting for the task to start before cancelling it[0m 67[38;2;248;248;242m [0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mAsync[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfromFuture[0m[38;2;248;248;242m([0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mpure[0m[38;2;248;248;242m([0m[38;2;248;248;242mlatch[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfuture[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m TODO get rid of this, IO, and Future here[0m 68[38;2;248;248;242m [0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m cancel[0m 69[38;2;248;248;242m [0m[3;38;2;253;151;31mresult[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m effect1[0m[38;2;248;248;242m.[0m[38;2;248;248;242mget[0m 70[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114myield[0m[38;2;248;248;242m result[0m 71 72[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Cancellation via start.flatMap(_.cancel)[0m 73[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mf2[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 74[38;2;248;248;242m [0m[3;38;2;253;151;31meffect2[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mDeferred[0m[38;2;248;248;242m.[0m[38;2;248;248;242muncancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m 75[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Using a latch to ensure that the task started[0m 76[38;2;248;248;242m [0m[3;38;2;253;151;31mlatch[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mDeferred[0m[38;2;248;248;242m.[0m[38;2;248;248;242muncancelable[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mUnit[0m[38;2;248;248;242m][0m 77[38;2;248;248;242m [0m[3;38;2;253;151;31mnever[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mbracket[0m[38;2;248;248;242m([0m[38;2;248;248;242mlatch[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcomplete[0m[38;2;248;248;242m([0m[38;2;190;132;255m()[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mnever[0m[38;2;248;248;242m[[0m[3;38;2;102;217;239mUnit[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m([0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m effect2[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcomplete[0m[38;2;248;248;242m([0m[38;2;248;248;242ma[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m 78[38;2;248;248;242m [0m[3;38;2;253;151;31mfiber[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mstart[0m[38;2;248;248;242m([0m[38;2;248;248;242mnever[0m[38;2;248;248;242m)[0m 79[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Waiting for the task to start before cancelling it[0m 80[38;2;248;248;242m [0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m latch[0m[38;2;248;248;242m.[0m[38;2;248;248;242mget[0m 81[38;2;248;248;242m [0m[38;2;255;255;255m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mstart[0m[38;2;248;248;242m([0m[38;2;248;248;242mfiber[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcancel[0m[38;2;248;248;242m)[0m 82[38;2;248;248;242m [0m[3;38;2;253;151;31mresult[0m[38;2;248;248;242m [0m[38;2;249;38;114m<-[0m[38;2;248;248;242m effect2[0m[38;2;248;248;242m.[0m[38;2;248;248;242mget[0m 83[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114myield[0m[38;2;248;248;242m result[0m 84 85[38;2;248;248;242m f1 <-> f2[0m 86[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 87 88[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mtoIORunCancelableConsistency[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m([0m[3;38;2;253;151;31mfa[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mA[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m 89[38;2;248;248;242m [0m[38;2;102;217;239mConcurrentEffect[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtoIOFromRunCancelable[0m[38;2;248;248;242m([0m[38;2;248;248;242mfa[0m[38;2;248;248;242m)[0m[38;2;248;248;242m <-> [0m[38;2;102;217;239mF[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtoIO[0m[38;2;248;248;242m([0m[38;2;248;248;242mfa[0m[38;2;248;248;242m)[0m 90[38;2;248;248;242m}[0m 91 92[3;38;2;102;217;239mobject[0m[4;38;2;102;217;239m ConcurrentEffectLaws[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 93[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mapply[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m[[0m[38;2;255;255;255m_[0m[38;2;248;248;242m][0m[38;2;248;248;242m][0m[38;2;248;248;242m([0m[38;2;249;38;114mimplicit[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mF0[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mConcurrentEffect[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcontextShift0[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mContextShift[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m[38;2;248;248;242m)[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mConcurrentEffectLaws[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m 94[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mConcurrentEffectLaws[0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mF[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m 95[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mF[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mF0[0m 96[38;2;248;248;242m [0m[3;38;2;102;217;239mval[0m[38;2;248;248;242m [0m[38;2;255;255;255mcontextShift[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m contextShift0[0m 97[38;2;248;248;242m [0m[38;2;248;248;242m}[0m 98[38;2;248;248;242m}[0m 99