aivika-transformers 6.0.0 → 6.1
raw patch · 3 files changed
+57/−22 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- Simulation/Aivika/Trans/Internal/Cont.hs +51/−21
- aivika-transformers.cabal +1/−1
CHANGELOG.md view
@@ -1,4 +1,9 @@ +Version 6.1+-----++* Fixed the contAwait function.+ Version 6.0 -----
Simulation/Aivika/Trans/Internal/Cont.hs view
@@ -763,7 +763,8 @@ Nothing -> error "The handler was lost: freezeCont." Just h ->- do invokeEvent p $ disposeEvent h+ do invokeEvent p $ writeRef rh Nothing+ invokeEvent p $ disposeEvent h c <- invokeEvent p $ readRef rc case c of Nothing -> return ()@@ -801,7 +802,8 @@ Nothing -> error "The handler was lost: freezeContReentering." Just h ->- do invokeEvent p $ disposeEvent h+ do invokeEvent p $ writeRef rh Nothing+ invokeEvent p $ disposeEvent h c <- invokeEvent p $ readRef rc case c of Nothing -> return ()@@ -870,7 +872,8 @@ Nothing -> error "The handler was lost: sleepCont." Just h ->- do invokeEvent p $ disposeEvent h+ do invokeEvent p $ writeRef rh Nothing+ invokeEvent p $ disposeEvent h case e of ContCancellationInitiating -> invokeEvent p $@@ -923,26 +926,53 @@ contAwait :: MonadDES m => Signal m a -> Cont m a {-# INLINABLE contAwait #-} contAwait signal =- Cont $ \c ->+ Cont $ \c0 -> Event $ \p -> do let r = pointRun p- c <- invokeEvent p $ freezeCont c- rh <- invokeSimulation r $ newRef Nothing- h <- invokeEvent p $- handleSignal signal $ - \a -> Event $ - \p -> do x <- invokeEvent p $ readRef rh- case x of- Nothing ->- error "The signal was lost: contAwait."- Just x ->- do invokeEvent p $ disposeEvent x- c <- invokeEvent p $ unfreezeCont c- case c of- Nothing -> return ()- Just c ->- invokeEvent p $ reenterCont c a- invokeEvent p $ writeRef rh $ Just h + c <- invokeEvent p $ freezeCont c0+ r1 <- invokeSimulation r $ newRef Nothing+ r2 <- invokeSimulation r $ newRef Nothing+ h1 <- invokeEvent p $+ handleSignal signal $ + \a -> Event $ + \p -> do x1 <- invokeEvent p $ readRef r1+ x2 <- invokeEvent p $ readRef r2+ invokeEvent p $ writeRef r1 Nothing+ invokeEvent p $ writeRef r2 Nothing+ case x1 of+ Nothing ->+ return ()+ Just h1 ->+ invokeEvent p $ disposeEvent h1+ case x2 of+ Nothing ->+ return ()+ Just h2 ->+ invokeEvent p $ disposeEvent h2+ c <- invokeEvent p $ unfreezeCont c+ case c of+ Nothing -> return ()+ Just c ->+ invokeEvent p $ reenterCont c a+ h2 <- invokeEvent p $+ handleSignal (contCancellationInitiating $ contId $ contAux c0) $+ \a -> Event $+ \p -> do x1 <- invokeEvent p $ readRef r1+ x2 <- invokeEvent p $ readRef r2+ invokeEvent p $ writeRef r1 Nothing+ invokeEvent p $ writeRef r2 Nothing+ case x1 of+ Nothing ->+ return ()+ Just h1 ->+ invokeEvent p $ disposeEvent h1+ case x2 of+ Nothing ->+ return ()+ Just h2 ->+ invokeEvent p $ disposeEvent h2+ invokeEvent p $ writeRef r1 $ Just h1 + invokeEvent p $ writeRef r2 $ Just h2 -- | Like the GoTo statement it transfers the direction of computation, -- but raises an exception when used within 'catchCont' or 'finallyCont'.
aivika-transformers.cabal view
@@ -1,5 +1,5 @@ name: aivika-transformers-version: 6.0.0+version: 6.1 synopsis: Transformers for the Aivika simulation library description: This package is a generalization of the aivika [1] simulation library