varying 0.7.0.0 → 0.7.0.1
raw patch · 3 files changed
+15/−15 lines, 3 files
Files
- src/Control/Varying/Core.hs +1/−1
- test/Main.hs +13/−13
- varying.cabal +1/−1
src/Control/Varying/Core.hs view
@@ -85,7 +85,7 @@ -- 9 instance (Applicative m, Monad m) => Functor (VarT m b) where fmap f v = (var f) . v--- | A very simple category instance.+-- | A very simple category instance. -- -- @ -- id = var id
test/Main.hs view
@@ -12,24 +12,24 @@ main :: IO () main = hspec $ do- describe "before" $ do+ describe "before" $ it "should produce events before a given step" $ do let varEv :: Var () (Maybe Int)- varEv = 1 ~> before 3+ varEv = 1 >>> before 3 scans = fst $ runIdentity $ scanVar varEv $ replicate 4 () scans `shouldBe` [Just 1, Just 2, Nothing, Nothing] - describe "after" $ do+ describe "after" $ it "should produce events after a given step" $ do let varEv :: Var () (Maybe Int)- varEv = 1 ~> after 3+ varEv = 1 >>> after 3 scans = fst $ runIdentity $ scanVar varEv $ replicate 4 () scans `shouldBe` [Nothing, Nothing, Just 3, Just 4]- describe "anyE" $ do+ describe "anyE" $ it "should produce on any event" $ do let v1,v2,v3 :: Var () (Maybe Int)- v1 = use 1 ((1 :: Var () Int) ~> before 2)- v2 = use 2 ((1 :: Var () Int) ~> after 3)+ v1 = use 1 ((1 :: Var () Int) >>> before 2)+ v2 = use 2 ((1 :: Var () Int) >>> after 3) v3 = always 3 v = anyE [v1,v2,v3] scans = fst $ runIdentity $ scanVar v $ replicate 4 ()@@ -49,7 +49,7 @@ describe "untilEvent" $ do let Identity scans = scanSpline (3 `untilEvent` ((1 :: Var () Int)- ~> after 10))+ >>> after 10)) 0 (replicate 10 ()) it "should produce output from the value stream until event procs" $@@ -160,9 +160,9 @@ -- Adherance to typeclass laws -------------------------------------------------------------------------------- -- Spline helpers- let inc = 1 ~> accumulate (+) 0+ let inc = 1 >>> accumulate (+) 0 sinc :: Spline a Int (Int, Int)- sinc = inc `untilEvent` (1 ~> after 3)+ sinc = inc `untilEvent` (1 >>> after 3) go a = runIdentity (scanSpline a 0 [0..9]) equal a b = go a `shouldBe` go b @@ -193,13 +193,13 @@ pfx = pure (1+1) it "(homomorphism) pure f <*> pure x = pure (f x)" $ equal pfpx pfx let u :: Spline a Int (Int -> Int)- u = pure 66 `_untilEvent` (use (+1) $ 1 ~> after (3 :: Int))+ u = pure 66 `_untilEvent` use (+1) (1 >>> after (3 :: Int)) upy = u <*> pure 1 pyu = pure ($ 1) <*> u it "(interchange) u <*> pure y = pure ($ y) <*> u" $ equal upy pyu let v :: Spline a Int (Int -> Int)- v = pure 66 `_untilEvent` (use (1-) $ 1 ~> after (4 :: Float))- w = pure 72 `_untilEvent` (use 3 $ 1 ~> after (1 :: Float))+ v = pure 66 `_untilEvent` (use (1-) $ 1 >>> after (4 :: Float))+ w = pure 72 `_untilEvent` (use 3 $ 1 >>> after (1 :: Float)) pduvw = pure (.) <*> u <*> v <*> w uvw = u <*> (v <*> w) it "(compisition) pure (.) <*> u <*> v <*> w = u <*> (v <*> w)" $
varying.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.7.0.0+version: 0.7.0.1 -- A short (one-line) description of the package. synopsis: FRP through value streams and monadic splines.