reactive 0.9.0 → 0.9.1
raw patch · 4 files changed
+18/−14 lines, 4 filesdep ~TypeCompose
Dependency ranges changed: TypeCompose
Files
- reactive.cabal +2/−2
- src/FRP/Reactive.hs +2/−0
- src/FRP/Reactive/PrimReactive.hs +13/−11
- src/FRP/Reactive/Reactive.hs +1/−1
reactive.cabal view
@@ -1,5 +1,5 @@ Name: reactive-Version: 0.9.0+Version: 0.9.1 Synopsis: Simple foundation for functional reactive programming Category: reactivity, FRP Description:@@ -33,7 +33,7 @@ Extra-Source-Files: Library Build-Depends: base, old-time, random, QuickCheck < 2.0,- TypeCompose>=0.3, vector-space>=0.5, unamb, checkers+ TypeCompose>=0.6.0, vector-space>=0.5, unamb, checkers -- This library uses the ImpredicativeTypes flag, and it depends -- on vector-space, which needs ghc >= 6.9 if impl(ghc < 6.9) {
src/FRP/Reactive.hs view
@@ -44,3 +44,5 @@ import FRP.Reactive.Reactive hiding (stepper,switcher,snapshotWith,snapshot,snapshot_,flipFlop,integral) import FRP.Reactive.Behavior+import FRP.Reactive.VectorSpace ()+import FRP.Reactive.Num ()
src/FRP/Reactive/PrimReactive.hs view
@@ -57,6 +57,8 @@ , batch, infE ) where +import Prelude hiding (zip)+ import Data.Monoid import Control.Applicative import Control.Monad@@ -75,7 +77,7 @@ -- TypeCompose import Control.Compose ((:.)(..), inO2, Monoid_f(..))-import Data.Pair+import Data.Zip import Control.Instances () -- Monoid (IO ()) import Data.Unamb (race)@@ -183,15 +185,15 @@ instance Ord t => Alternative (EventG t) where { empty = mempty; (<|>) = mappend } -instance Ord t => Pair (ReactiveG t) where- -- pair :: ReactiveG t a -> ReactiveG t b -> ReactiveG t (a,b)- (c `Stepper` ce) `pair` (d `Stepper` de) =+instance Ord t => Zip (ReactiveG t) where+ -- zip :: ReactiveG t a -> ReactiveG t b -> ReactiveG t (a,b)+ (c `Stepper` ce) `zip` (d `Stepper` de) = (c,d) `accumR` pairEdit (ce,de) instance Ord t => Applicative (ReactiveG t) where pure a = a `stepper` mempty- -- Standard definition. See 'Pair'.- rf <*> rx = uncurry ($) <$> (rf `pair` rx)+ -- Standard definition. See 'Zip'.+ rf <*> rx = uncurry ($) <$> (rf `zip` rx) -- A wonderful thing about the <*> definition for ReactiveG is that it -- automatically caches the previous value of the function or argument@@ -444,9 +446,9 @@ -- Standard instances instance (Monoid_f f, Ord t) => Monoid_f (ReactiveG t :. f) where { mempty_f = O (pure mempty_f); mappend_f = inO2 (liftA2 mappend_f) }-instance (Ord t, Pair f) => Pair (ReactiveG t :. f) where pair = apPair+instance (Ord t, Zip f) => Zip (ReactiveG t :. f) where zip = apZip -instance Unpair (ReactiveG t) where {pfst = fmap fst; psnd = fmap snd}+instance Unzip (ReactiveG t) where {fsts = fmap fst; snds = fmap snd} -- Standard instances instance Ord t => Monoid_f (EventG t) where@@ -455,11 +457,11 @@ { mempty = O mempty; mappend = inO2 mappend } instance Ord t => Monoid_f (EventG t :. f) where { mempty_f = mempty ; mappend_f = mappend }-instance (Ord t, Copair f) => Pair (EventG t :. f) where- pair = copair+instance (Ord t, Cozip f) => Zip (EventG t :. f) where+ zip = cozip -- Standard instance for functors-instance Unpair (EventG t) where {pfst = fmap fst; psnd = fmap snd}+instance Unzip (EventG t) where {fsts = fmap fst; snds = fmap snd} {--------------------------------------------------------------------
src/FRP/Reactive/Reactive.hs view
@@ -56,7 +56,7 @@ import Data.VectorSpace -- TypeCompose-import Data.Pair (pairEdit)+import Data.Zip (pairEdit) import Data.Max import Data.AddBounds