packages feed

reactivity 0.3.2.3 → 0.3.2.4

raw patch · 5 files changed

+13/−10 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.WeakDict: lookupWeak :: Eq a1 => a1 -> WeakDict a1 a -> IO (Maybe a)
+ Data.WeakDict: lookupWeak :: Eq a => a -> WeakDict a a1 -> IO (Maybe a1)
- FRP.Reactivity.AlternateEvent: class (MonadPlus e) => EventStream e
+ FRP.Reactivity.AlternateEvent: class (Functor e, MonadPlus e) => EventStream e
- FRP.Reactivity.AlternateEvent: scan' :: (t2 -> Measurement t1 -> (t2, Measurement t)) -> t2 -> [Measurement t1] -> Event t
+ FRP.Reactivity.AlternateEvent: scan' :: (t1 -> Measurement t2 -> (t1, Measurement t)) -> t1 -> [Measurement t2] -> Event t
- FRP.Reactivity.Combinators: count :: (Num t, EventStream e) => e t1 -> e (t1, t)
+ FRP.Reactivity.Combinators: count :: (EventStream e, Num t1) => e t -> e (t, t1)
- FRP.Reactivity.Combinators: differenceE :: EventStream f => f b1 -> f b -> f b1
+ FRP.Reactivity.Combinators: differenceE :: EventStream f => f b -> f b1 -> f b
- FRP.Reactivity.Combinators: dropE :: (EventStream f, Num b1, Ord b1) => b1 -> f b -> f b
+ FRP.Reactivity.Combinators: dropE :: (EventStream f, Ord b1, Num b1) => b1 -> f b -> f b
- FRP.Reactivity.Combinators: eitherOf :: (MonadPlus e) => e t -> e u -> e (Either t u)
+ FRP.Reactivity.Combinators: eitherOf :: (Functor e, MonadPlus e) => e t -> e u -> e (Either t u)
- FRP.Reactivity.Combinators: flipFlop :: MonadPlus e => e b1 -> e b -> Behavior e Bool
+ FRP.Reactivity.Combinators: flipFlop :: MonadPlus e => e b -> e b1 -> Behavior e Bool
- FRP.Reactivity.Combinators: justE :: (Monad f, Alternative f) => f (Maybe b) -> f b
+ FRP.Reactivity.Combinators: justE :: (Alternative f, Monad f) => f (Maybe b) -> f b
- FRP.Reactivity.Combinators: snapshot :: EventStream f => f t1 -> Behavior f t -> f (t1, t)
+ FRP.Reactivity.Combinators: snapshot :: EventStream f => f t -> Behavior f t1 -> f (t, t1)
- FRP.Reactivity.Combinators: zipE :: EventStream f => f t1 -> t1 -> f t -> t -> f (t1, t)
+ FRP.Reactivity.Combinators: zipE :: EventStream f => f t -> t -> f t1 -> t1 -> f (t, t1)

Files

reactivity.cabal view
@@ -1,5 +1,5 @@ Name:                reactivity-Version:             0.3.2.3+Version:             0.3.2.4 Synopsis:            An alternate implementation of push-pull FRP. Category:            reactivity, FRP Description:         An alternate implementation of push-pull FRP. This is based on the Reactive package (http://haskell.org/haskellwiki/reactive) (and the sources have been made available in accordance with the GPL [license] of that package).
src/Control/CUtils/FChan.hs view
@@ -14,7 +14,7 @@ 
 import System.IO.Unsafe
 
-newtype Chan t = Chan {-# NOUNPACK #-} (MVar (t, Chan t))
+newtype Chan t = Chan (MVar (t, Chan t))
 
 -- | Construct a channel from a list.
 {-# NOINLINE listToChan #-}
src/FRP/Reactivity/AlternateEvent.hs view
@@ -10,17 +10,19 @@ import Data.Unique
 import Data.IORef
 import Data.Typeable
-import Control.Monad
-import Control.Monad.IO.Class
-import Control.Monad.Reader
+import Data.Time.Clock.POSIX
+import Data.Maybe
+import Data.Monoid
+import Data.Traversable
+import Control.Monad hiding (mapM)
+import Control.Monad.Reader hiding (mapM)
 import Control.Applicative
 import Control.Concurrent
 import Control.Monad.Catch
 import System.IO.Unsafe
-import Data.Time.Clock.POSIX
-import Data.Maybe
 import FRP.Reactivity.Measurement
 import FRP.Reactivity.RPC
+import Prelude hiding (mapM)
 
 -- | Event streams are here presented using the publisher-subscriber model (push-based handling
 --   in contrast to the pull-based handling of 'MeasurementWrapper'). Such an event
@@ -83,7 +85,7 @@ 	empty = mzero
 	(<|>) = mplus
 
-class (MonadPlus e) => EventStream e where
+class (Functor e, MonadPlus e) => EventStream e where
 	-- | Prooty self-explanatory.
 	eventFromList :: [(t, POSIXTime)] -> e t
 	-- | The "scan" primitive is analogous to "scanl" for lists.
@@ -138,7 +140,7 @@ 		-- Machinery to keep track of subscriptions. This will maintain a set of callbacks
 		-- that want to receive messages. When a subscriber unsubscribes, it will be
 		-- removed from the set.
-		add ref x = measure (return ()) >>= \meas -> readIORef ref >>= \mp -> mapM_ (\f -> f x (time meas)) mp
+		add ref x = measure (return ()) >>= \meas -> readIORef ref >>= \mp -> void $ mapM (\f -> f x (time meas)) mp
 		unsub ref un = _nonDispatchedIO $ atomicModifyIORef ref (\mp -> (M.delete un mp, ()))
 		e ref = Event (\f -> _nonDispatchedIO newUnique >>= \un ->
 			RPC ask >>= \(_, mv) ->
src/FRP/Reactivity/Combinators.hs view
@@ -35,7 +35,7 @@ untilE e u = switch (return e `mplus` fmap (const mzero) u)
 
 {-# INLINE eitherOf #-}
-eitherOf :: (MonadPlus e) => e t -> e u -> e (Either t u)
+eitherOf :: (Functor e, MonadPlus e) => e t -> e u -> e (Either t u)
 eitherOf e e2 = fmap Left e `mplus` fmap Right e2
 
 -- | Give the event times of 'e', but latching onto the ticks of 'e2'. Prior to 'e2' ticking, gives 'x'.
src/FRP/Reactivity/MeasurementWrapper.hs view
@@ -6,6 +6,7 @@ import FRP.Reactivity.Measurement
 import Data.Time.Clock.POSIX
 import Data.Typeable
+import Data.Monoid
 import Control.Monad
 import Control.Monad.Fix
 import Control.Applicative