AsyncRattus 0.1.0.2 → 0.1.0.3
raw patch · 3 files changed
+14/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- AsyncRattus.cabal +1/−1
- CHANGELOG.md +7/−1
- src/AsyncRattus/Channels.hs +6/−6
AsyncRattus.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: AsyncRattus-version: 0.1.0.2+version: 0.1.0.3 category: FRP synopsis: An asynchronous modal FRP language description:
CHANGELOG.md view
@@ -1,4 +1,10 @@-# 0.1.0.1+# 0.1.0.3++Fix concurrency bug in the interaction of output and input channels.+This occurred when using mkInput (and thus also filter functions on+signals).++# 0.1.0.2 Make Integer and Text stable types
src/AsyncRattus/Channels.hs view
@@ -25,7 +25,7 @@ import AsyncRattus.Plugin.Annotation import AsyncRattus.Strict-import Control.Concurrent.MVar+import Control.Concurrent.Chan import Control.Monad import System.IO.Unsafe import Data.IORef@@ -67,8 +67,8 @@ {-# NOINLINE input #-}-input :: MVar InputValue-input = unsafePerformIO newEmptyMVar+input :: Chan InputValue+input = unsafePerformIO newChan data OutputChannel where OutputChannel :: Producer p a => !(O p) -> !(a -> IO ()) -> OutputChannel@@ -90,7 +90,7 @@ getInput :: IO (Box (O a) :* (a -> IO ())) getInput = do ch <- atomicModifyIORef nextFreshChannel (\ x -> (x - 1, x)) return ((box (Delay (singletonClock ch) (\ (InputValue _ v) -> unsafeCoerce v)))- :* \ x -> putMVar input (InputValue ch x))+ :* \ x -> writeChan input (InputValue ch x)) setOutput' :: Producer p a => (a -> IO ()) -> O p -> IO () setOutput' cb !sig = do@@ -98,7 +98,7 @@ let upd Nothing = (Just (ref :! Nil),()) upd (Just ls) = (Just (ref :! ls),()) let upd' ch Nothing = do- forkIO (threadDelay ch >> putMVar input (InputValue ch ()))+ forkIO (threadDelay ch >> writeChan input (InputValue ch ())) return (Just (ref :! Nil),()) upd' _ (Just ls) = return (Just (ref :! ls),()) let run pre ch =@@ -152,7 +152,7 @@ {-# ANN eventLoop NotAsyncRattus #-} eventLoop :: IO ()-eventLoop = do inp@(InputValue ch _) <- takeMVar input+eventLoop = do inp@(InputValue ch _) <- readChan input res <- H.lookup output ch case res of Nothing -> return ()