packages feed

sodium 0.11.0.1 → 0.11.0.2

raw patch · 2 files changed

+17/−11 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- FRP.Sodium.Internal: Sample :: IO a -> Dep -> IORef () -> Sample a
+ FRP.Sodium.Internal: Sample :: IO a -> Dep -> Maybe (IORef ()) -> Sample a
- FRP.Sodium.Internal: sampleKeepAlive :: Sample a -> IORef ()
+ FRP.Sodium.Internal: sampleKeepAlive :: Sample a -> Maybe (IORef ())

Files

sodium.cabal view
@@ -1,5 +1,5 @@ name:                sodium-version:             0.11.0.1+version:             0.11.0.2 synopsis:            Sodium Reactive Programming (FRP) System description:            A general purpose Reactive Programming (FRP) system. This is part of a project to@@ -54,7 +54,9 @@   .    * 0.11.0.0 - Make 'merge' left-biased, like Reactive Banana.   .-   * 0.11.0.1 - Thank you Samuel Gélineau. Fix regression when using in ghc-7.8: prevent keepAlive from being GC'd early+   * 0.11.0.1 - Fix regression when using in ghc-7.8: prevent keepAlive from being GC'd early+  .+   * 0.11.0.2 - Thank you Samuel Gélineau. Fix breakage in 0.11.0.1.  license:             BSD3 license-file:        LICENSE
src/FRP/Sodium/Plain.hs view
@@ -88,7 +88,7 @@ data Sample a = Sample {         unSample :: IO a,         sDep     :: Dep,-        sampleKeepAlive :: IORef ()+        sampleKeepAlive :: Maybe (IORef ())     }  instance R.Context Plain where@@ -260,7 +260,7 @@             writeIORef bsRef $ newCurrent `seq` BehaviorState newCurrent Nothing     keepAliveRef <- ioReactive $ newIORef ()     sample <- ioReactive $ addCleanup_Sample unlistener-        (Sample (bsCurrent <$> readIORef bsRef) (dep ea) keepAliveRef)+        (Sample (bsCurrent <$> readIORef bsRef) (dep ea) (Just keepAliveRef))     let beh = sample `seq` Behavior {                 updates_   = ea,                 sampleImpl = sample@@ -351,7 +351,9 @@ {-# NOINLINE sample #-} sample beh = ioReactive $ do     let sample = sampleImpl beh-    readIORef (sampleKeepAlive sample)  -- defeat optimizer on ghc-7.8+    maybe (return ())+          readIORef+          (sampleKeepAlive sample)  -- defeat optimizer on ghc-7.8     unSample sample  -- | If there's more than one firing in a single transaction, combine them into@@ -725,12 +727,12 @@       where         fe = f `fmap` e         s' = unSample s-        fs = s' `seq` Sample (f `fmap` s') (dep s) undefined+        fs = s' `seq` Sample (f `fmap` s') (dep s) Nothing  constant :: a -> Behavior a constant a = Behavior {         updates_   = never,-        sampleImpl = Sample (return a) undefined undefined+        sampleImpl = Sample (return a) undefined Nothing     }  data BehaviorState a = BehaviorState {@@ -757,9 +759,11 @@ -- | Add a finalizer to a Reactive. finalizeSample :: Sample a -> IO () -> IO (Sample a) {-# NOINLINE finalizeSample #-}-finalizeSample s unlisten = do-    mkWeakIORef (sampleKeepAlive s) unlisten-    return s+finalizeSample s unlisten = case sampleKeepAlive s of+    Just keepaliveRef -> do+        mkWeakIORef keepaliveRef unlisten+        return s+    Nothing -> error "finalizeSample called on sample with no keepAlive"  newtype Unlistener = Unlistener (MVar (Maybe (IO ()))) @@ -868,7 +872,7 @@                     push (f a)                 return (un1 >> un2)             addCleanup_Listen unlistener l-        s = s1' `seq` s2' `seq` Sample (($) <$> s1' <*> s2') (dep (s1, s2)) keepaliveRef+        s = s1' `seq` s2' `seq` Sample (($) <$> s1' <*> s2') (dep (s1, s2)) (Just keepaliveRef)  {- -- | Cross the specified event over to a different partition.