From 0e9cd058cbb8ab5b1bf275bb4e5be9160773b410 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 07:50:34 +0000 Subject: [PATCH 1/8] yampa-test: Move definitions to separate line (KSG Haskell 1.3.0 - 5.2). Refs #292. Prefer where appearing alone on a single line, not at the end of a line or on the same line as the definition it introduces. --- yampa-test/tests/Test/FRP/Yampa/Basic.hs | 35 ++-- yampa-test/tests/Test/FRP/Yampa/Delays.hs | 21 +- yampa-test/tests/Test/FRP/Yampa/EventS.hs | 31 +-- .../tests/Test/FRP/Yampa/Integration.hs | 13 +- .../tests/Test/FRP/Yampa/InternalCore.hs | 185 ++++++++++-------- yampa-test/tests/Test/FRP/Yampa/Switches.hs | 40 ++-- yampa-test/tests/Test/FRP/Yampa/Time.hs | 60 +++--- 7 files changed, 211 insertions(+), 174 deletions(-) diff --git a/yampa-test/tests/Test/FRP/Yampa/Basic.hs b/yampa-test/tests/Test/FRP/Yampa/Basic.hs index 9dbeed3f..c13266f6 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Basic.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Basic.hs @@ -55,15 +55,17 @@ basicsf_t0r = -- Yampa's Basic SF builders prop_basic_identity_1 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream - sf = identity - pred = (==) + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream + sf = identity + pred = (==) prop_basic_identity_2 = forAll myStream (evalT $ prop_always_equal identity (arr id)) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream -- ** constant @@ -77,11 +79,12 @@ basicsf_t1r = prop_basic_constant = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sf = constant 42.0 - pred = const (== 42.0) + sf = constant 42.0 + pred = const (== 42.0) -- * Initialization @@ -265,11 +268,12 @@ basicsf_t4r = prop_basic_initially = forAll myStream $ evalT $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sf = initially 42.0 - pred = const (== 42.0) + sf = initially 42.0 + pred = const (== 42.0) -- * Auxiliary @@ -279,4 +283,5 @@ prop (a,b) = SP ((identity &&& a) >>^ uncurry b) -- | Compares two SFs, resulting in true if they are always equal prop_always_equal sf1 sf2 = Always $ SP ((sf1 &&& sf2) >>> arr sameResult) - where sameResult = uncurry (==) + where + sameResult = uncurry (==) diff --git a/yampa-test/tests/Test/FRP/Yampa/Delays.hs b/yampa-test/tests/Test/FRP/Yampa/Delays.hs index fc651887..485a89cb 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Delays.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Delays.hs @@ -315,11 +315,12 @@ delay_t5r = take 100 (drop 6 (embed sf (deltaEncode 0.1 (repeat ())))) -- | Delaying by 0.0 has no effect prop_delay_1 = forAll myStream $ evalT $ prop_always_equal sfDelayed sf - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sfDelayed = delay 0.0 undefined >>> sf - sf = arr (+1) + sfDelayed = delay 0.0 undefined >>> sf + sf = arr (+1) -- | Delaying input signal by a small amount will fill in the "blank" signal -- with the given value, which will become also the sample at the initial @@ -327,12 +328,13 @@ prop_delay_1 = prop_delay_2 = forAll myStream $ evalT $ (prop (sfDelayed, (\x y -> y == initialValue))) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sfDelayed = delay 0.0001 initialValue + sfDelayed = delay 0.0001 initialValue - initialValue = 17 + initialValue = 17 -- * Auxiliary @@ -342,4 +344,5 @@ prop (a,b) = SP ((identity &&& a) >>^ uncurry b) -- | Compares two SFs, resulting in true if they are always equal prop_always_equal sf1 sf2 = Always $ SP ((sf1 &&& sf2) >>> arr sameResult) - where sameResult = uncurry (==) + where + sameResult = uncurry (==) diff --git a/yampa-test/tests/Test/FRP/Yampa/EventS.hs b/yampa-test/tests/Test/FRP/Yampa/EventS.hs index 7ee56417..3c16e542 100644 --- a/yampa-test/tests/Test/FRP/Yampa/EventS.hs +++ b/yampa-test/tests/Test/FRP/Yampa/EventS.hs @@ -102,10 +102,11 @@ evsrc_t0r = prop_event_noevent = forAll myStream $ evalT $ Always $ prop (sfNever, const (== noEvent)) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream - sfNever :: SF Float (Event Float) - sfNever = never + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream + sfNever :: SF Float (Event Float) + sfNever = never evsrc_t1 :: [Event Int] evsrc_t1 = testSF1 (now 42) @@ -127,13 +128,14 @@ prop_event_now = And (prop (sf, p0)) -- Initially (Next $ Always $ prop (sf, pn)) -- After first sample - where sf = Yampa.now 42.0 + where + sf = Yampa.now 42.0 - p0 x y = y == Event 42.0 - pn x y = y == noEvent + p0 x y = y == Event 42.0 + pn x y = y == noEvent - myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream evsrc_t2 :: [Event Int] evsrc_t2 = testSF1 (after 0.0 42) @@ -154,13 +156,14 @@ prop_event_after_0 = And (prop (sf, p0)) -- Initially (Next $ Always $ prop (sf, pn)) -- After first sample - where sf = after 0.0 42.0 + where + sf = after 0.0 42.0 - p0 x y = y == Event 42.0 - pn x y = y == noEvent + p0 x y = y == Event 42.0 + pn x y = y == noEvent - myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream evsrc_t3 :: [Event Int] evsrc_t3 = testSF1 (after 3.0 42) diff --git a/yampa-test/tests/Test/FRP/Yampa/Integration.hs b/yampa-test/tests/Test/FRP/Yampa/Integration.hs index f021fdba..0220e70f 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Integration.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Integration.hs @@ -237,15 +237,16 @@ prop_derivative_1 = forAll myStream $ evalT $ Next $ Always $ prop ((sfDer &&& sfDerByHand), const close) - where myStream :: Gen (SignalSampleStream Double) - myStream = fixedDelayStreamWith (\t -> sin(2 * pi * t)) der_step + where + myStream :: Gen (SignalSampleStream Double) + myStream = fixedDelayStreamWith (\t -> sin(2 * pi * t)) der_step - sfDer :: SF Time Time - sfDer = derivative + sfDer :: SF Time Time + sfDer = derivative - sfDerByHand = localTime >>> arr (\t -> (2 * pi * cos (2 * pi * t))) + sfDerByHand = localTime >>> arr (\t -> (2 * pi * cos (2 * pi * t))) - close (x,y) = abs (x-y) < 0.05 + close (x,y) = abs (x-y) < 0.05 prop_derivative_2 = forAll myStream $ evalT $ diff --git a/yampa-test/tests/Test/FRP/Yampa/InternalCore.hs b/yampa-test/tests/Test/FRP/Yampa/InternalCore.hs index 4fcde3b7..51a9b4a8 100644 --- a/yampa-test/tests/Test/FRP/Yampa/InternalCore.hs +++ b/yampa-test/tests/Test/FRP/Yampa/InternalCore.hs @@ -110,18 +110,20 @@ arr_t1r = prop_arrow_1 = forAll myStream $ evalT $ Always $ prop (arr id, \x y -> x == y) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream -- C1: Arr naturality (testSF1 (arr (+1))) prop_arr_naturality = forAll myStream $ \stream -> forAll f $ \f' -> evalT (Always (prop (arr (apply f'), \x y -> apply f' x == y))) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream - f :: Gen (Fun Int Int) - f = arbitrary + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream + f :: Gen (Fun Int Int) + f = arbitrary comp_t0 = testSF1 ((arr (+1)) >>> (arr (+2))) comp_t0r :: [Double] @@ -170,31 +172,34 @@ comp_t5r = -- Arrow composition (we use Int to avoid floating-point discrepancies) prop_arrow_comp_1 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Int) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Int) + myStream = uniDistStream - sf = arr (+1) >>> arr (+2) - pred = (\x y -> x + 3 == y) + sf = arr (+1) >>> arr (+2) + pred = (\x y -> x + 3 == y) -- Arrow composition prop_arrow_comp_2 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sf = constant 5.0 >>> arr (+1) - pred = const (== 6.0) + sf = constant 5.0 >>> arr (+1) + pred = const (== 6.0) -- Arrow composition prop_arrow_comp_3 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = fixedDelayStream 0.25 + where + myStream :: Gen (SignalSampleStream Float) + myStream = fixedDelayStream 0.25 - sf :: SF a Float - sf = constant 2.0 >>> integral >>> stepDiff (-0.5) + sf :: SF a Float + sf = constant 2.0 >>> integral >>> stepDiff (-0.5) - pred = const (== 0.5) + pred = const (== 0.5) first_t0 :: [(Int,Double)] first_t0 = testSF1 (arr dup >>> first (constant 7)) @@ -260,19 +265,21 @@ first_t5r = prop_arrow_first_1 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Int) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Int) + myStream = uniDistStream - sf = arr dup >>> first (constant 7) - pred = (\x y -> (7 :: Int, x) == y) + sf = arr dup >>> first (constant 7) + pred = (\x y -> (7 :: Int, x) == y) prop_arrow_first_2 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Int) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Int) + myStream = uniDistStream - sf = arr dup >>> first (arr (+1)) - pred = (\x y -> (x + 1, x) == y) + sf = arr dup >>> first (arr (+1)) + pred = (\x y -> (x + 1, x) == y) -- Test cases for second -- These should mirror the test cases for first. @@ -297,19 +304,21 @@ second_t5 = testSF2 (arr dup >>> second integral >>> arr swap) prop_arrow_second_1 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Int) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Int) + myStream = uniDistStream - sf = arr dup >>> second (constant 7) - pred = (\x y -> (x, 7 :: Int) == y) + sf = arr dup >>> second (constant 7) + pred = (\x y -> (x, 7 :: Int) == y) prop_arrow_second_2 = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Int) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Int) + myStream = uniDistStream - sf = arr dup >>> second (arr (+1)) - pred = (\x y -> (x, x + 1) == y) + sf = arr dup >>> second (arr (+1)) + pred = (\x y -> (x, x + 1) == y) -- For a description of the laws, see e.g. Ross Paterson: Embedding a Class of -- Domain-Specific Languages in a Functional Language. @@ -324,12 +333,13 @@ laws_t0_rhs = testSF1 (integral) prop_arrow_id_0 = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> pred) - where sf1 = arr id >>> integral - sf2 = integral - pred = arr $ uncurry (==) + where + sf1 = arr id >>> integral + sf2 = integral + pred = arr $ uncurry (==) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream laws_t1_lhs :: [Double] laws_t1_lhs = testSF1 (integral >>> arr id) @@ -338,12 +348,13 @@ laws_t1_rhs = testSF1 (integral) prop_arrow_id_2 = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> pred) - where sf1 = integral >>> arr id - sf2 = integral - pred = arr $ uncurry (==) + where + sf1 = integral >>> arr id + sf2 = integral + pred = arr $ uncurry (==) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream laws_t2_lhs :: [Double] laws_t2_lhs = testSF1 ((integral >>> arr (*0.5)) >>> integral) @@ -352,12 +363,13 @@ laws_t2_rhs = testSF1 (integral >>> (arr (*0.5) >>> integral)) prop_arrow_assoc = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> pred) - where sf1 = (integral >>> arr (*0.5)) >>> integral - sf2 = integral >>> (arr (*0.5) >>> integral) - pred = arr $ uncurry (==) + where + sf1 = (integral >>> arr (*0.5)) >>> integral + sf2 = integral >>> (arr (*0.5) >>> integral) + pred = arr $ uncurry (==) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream laws_t3_lhs :: [Double] laws_t3_lhs = testSF1 (arr ((*2.5) . (+3.0))) @@ -366,21 +378,23 @@ laws_t3_rhs = testSF1 (arr (+3.0) >>> arr (*2.5)) prop_arrow_arr_comp = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> pred) - where sf1 = (arr ((*2.5) . (+3.0))) - sf2 = (arr (+3.0) >>> arr (*2.5)) - pred = arr (uncurry (==)) + where + sf1 = (arr ((*2.5) . (+3.0))) + sf2 = (arr (+3.0) >>> arr (*2.5)) + pred = arr (uncurry (==)) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream prop_arrow_2 = forAll myStream $ evalT $ Always $ prop (sf1 &&& sf2, const $ uncurry (==)) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream - sf1 = arr (f >>> g) - sf2 = arr f >>> arr g - f = (+5) - g = (/20) + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream + sf1 = arr (f >>> g) + sf2 = arr f >>> arr g + f = (+5) + g = (/20) prop_arrow_2' = forAll f $ \f' -> @@ -388,17 +402,19 @@ prop_arrow_2' = forAll myStream $ evalT $ prop_arrow_2'' (apply f') (apply g') - where myStream :: Gen (SignalSampleStream Int) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Int) + myStream = uniDistStream - f, g :: Gen (Fun Int Int) - f = arbitrary - g = arbitrary + f, g :: Gen (Fun Int Int) + f = arbitrary + g = arbitrary prop_arrow_2'' f g = Always $ prop (sf1 &&& sf2, const $ uncurry (==)) - where sf1 = arr (f >>> g) - sf2 = arr f >>> arr g + where + sf1 = arr (f >>> g) + sf2 = arr f >>> arr g laws_t4_lhs :: [(Double, Double)] laws_t4_lhs = testSF1 (arr dup >>> first (arr (*2.5))) @@ -407,12 +423,13 @@ laws_t4_rhs = testSF1 (arr dup >>> arr ((*2.5) *** id)) prop_arrow_first_3 = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> arr pred) - where sf1 = (arr dup >>> first (arr (*2.5))) - sf2 = (arr dup >>> arr (fun_prod (*2.5) id)) - pred = uncurry (==) + where + sf1 = (arr dup >>> first (arr (*2.5))) + sf2 = (arr dup >>> arr (fun_prod (*2.5) id)) + pred = uncurry (==) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream laws_t5_lhs :: [(Double, Double)] laws_t5_lhs = testSF1 (arr dup >>> (first (integral >>> arr (+3.0)))) @@ -421,12 +438,13 @@ laws_t5_rhs = testSF1 (arr dup >>> (first integral >>> first (arr (+3.0)))) prop_arrow_first_distrib = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> arr pred) - where sf1 = (arr dup >>> (first (integral >>> arr (+3.0)))) - sf2 = (arr dup >>> (first integral >>> first (arr (+3.0)))) - pred = uncurry (==) + where + sf1 = (arr dup >>> (first (integral >>> arr (+3.0)))) + sf2 = (arr dup >>> (first integral >>> first (arr (+3.0)))) + pred = uncurry (==) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream laws_t6_lhs :: [(Double, Double)] laws_t6_lhs = testSF1 (arr dup >>> (first integral >>> arr (id *** (+3.0)))) @@ -435,12 +453,13 @@ laws_t6_rhs = testSF1 (arr dup >>> (arr (id *** (+3.0)) >>> first integral)) prop_arrow_first_id_comm = forAll myStream $ evalT $ Always $ SP ((sf1 &&& sf2) >>> arr pred) - where sf1 = (arr dup >>> (first integral>>>arr (fun_prod id (+3.0)))) - sf2 = (arr dup >>> (arr (fun_prod id (+3.0))>>>first integral)) - pred = uncurry (==) + where + sf1 = (arr dup >>> (first integral>>>arr (fun_prod id (+3.0)))) + sf2 = (arr dup >>> (arr (fun_prod id (+3.0))>>>first integral)) + pred = uncurry (==) - myStream :: Gen (SignalSampleStream Double) - myStream = uniDistStream + myStream :: Gen (SignalSampleStream Double) + myStream = uniDistStream laws_t7_lhs :: [Double] laws_t7_lhs = testSF1 (arr dup >>> (first integral >>> arr fst)) diff --git a/yampa-test/tests/Test/FRP/Yampa/Switches.hs b/yampa-test/tests/Test/FRP/Yampa/Switches.hs index 1045d01c..829b4cba 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Switches.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Switches.hs @@ -173,21 +173,22 @@ prop_switch_t1 = forAll myStream $ evalT $ Always $ SP ((switch_t1rec 42.0 &&& switch_tr) >>> arr same) - where myStream :: Gen (SignalSampleStream Double) - myStream = fixedDelayStreamWith f 1.0 - f dt = l!!(floor dt) - l = [ 1.0, 1.0, 1.0 - , 2.0 - , 3.0, 3.0 - , 4.0, 4.0, 4.0 - , 5.0 - , 6.0, 6.0 - , 7.0, 7.0, 7.0 - , 8.0 - ] - ++ repeat 9.0 - - same = (uncurry (==)) + where + myStream :: Gen (SignalSampleStream Double) + myStream = fixedDelayStreamWith f 1.0 + f dt = l!!(floor dt) + l = [ 1.0, 1.0, 1.0 + , 2.0 + , 3.0, 3.0 + , 4.0, 4.0, 4.0 + , 5.0 + , 6.0, 6.0 + , 7.0, 7.0, 7.0 + , 8.0 + ] + ++ repeat 9.0 + + same = (uncurry (==)) switch_tr :: SF Double (Double, Double, Double) switch_tr = proc (a) -> do @@ -524,11 +525,12 @@ coc_t0r = -- TODO: Add integral to the list of SFs being tested prop_broadcast = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sf = parB [identity, (arr (+1))] - pred = (\x [y,z] -> x == y && (x + 1) == z) + sf = parB [identity, (arr (+1))] + pred = (\x [y,z] -> x == y && (x + 1) == z) pswitch_inp1 = deltaEncode 0.1 [0.0, 0.5 ..] diff --git a/yampa-test/tests/Test/FRP/Yampa/Time.hs b/yampa-test/tests/Test/FRP/Yampa/Time.hs index 60d68bab..9aea267d 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Time.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Time.hs @@ -39,17 +39,18 @@ basicsf_t2r = prop_basic_localtime_increasing = forAll myStream $ evalT $ Always $ prop (sf, const (uncurry (>))) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sf :: SF a (Time, Time) - sf = loopPre (-1 :: Time) sfI + sf :: SF a (Time, Time) + sf = loopPre (-1 :: Time) sfI - sfI :: SF (a,Time) ((Time, Time), Time) - sfI = (localTime *** identity) >>> arr resort + sfI :: SF (a,Time) ((Time, Time), Time) + sfI = (localTime *** identity) >>> arr resort - resort :: (Time, Time) -> ((Time,Time),Time) - resort (newT, oldT) = ((newT, oldT), newT) + resort :: (Time, Time) -> ((Time,Time),Time) + resort (newT, oldT) = ((newT, oldT), newT) basicsf_t3 :: [Double] basicsf_t3 = testSF1 time @@ -66,44 +67,47 @@ basicsf_t3r = -- greater than the acc. prop_basic_time_increasing = forAll myStream $ evalT $ Always $ prop (sf, pred) - where myStream :: Gen (SignalSampleStream Float) - myStream = uniDistStream + where + myStream :: Gen (SignalSampleStream Float) + myStream = uniDistStream - sf :: SF a (Time, Time) - sf = loopPre (-1 :: Time) sfI + sf :: SF a (Time, Time) + sf = loopPre (-1 :: Time) sfI - sfI :: SF (a,Time) ((Time, Time), Time) - sfI = (time *** identity) >>> arr resort + sfI :: SF (a,Time) ((Time, Time), Time) + sfI = (time *** identity) >>> arr resort - resort :: (Time, Time) -> ((Time,Time),Time) - resort (newT, oldT) = ((newT, oldT), newT) + resort :: (Time, Time) -> ((Time,Time),Time) + resort (newT, oldT) = ((newT, oldT), newT) - pred :: a -> (Time, Time) -> Bool - pred _ (t,o) = (t > o) + pred :: a -> (Time, Time) -> Bool + pred _ (t,o) = (t > o) prop_basic_time_fixed_delay = forAll myStream $ evalT $ Always (prop (sf25msec, const (== d))) - where myStream :: Gen (SignalSampleStream Float) - myStream = fixedDelayStream d + where + myStream :: Gen (SignalSampleStream Float) + myStream = fixedDelayStream d - sf25msec = time >>> stepDiff (-d) + sf25msec = time >>> stepDiff (-d) - d :: Time - d = 0.25 + d :: Time + d = 0.25 prop_basic_localtime_fixed_delay = forAll myStream $ evalT $ Always (prop (sf25msec, const (== d))) - where myStream :: Gen (SignalSampleStream Float) - myStream = fixedDelayStream d + where + myStream :: Gen (SignalSampleStream Float) + myStream = fixedDelayStream d - sf25msec = time >>> stepDiff (-d) + sf25msec = time >>> stepDiff (-d) - d :: Time - d = 0.25 + d :: Time + d = 0.25 -- * Auxiliary From 245d2f556004f5520e702f80f5ed0c23ef2253fa Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 07:51:49 +0000 Subject: [PATCH 2/8] yampa-test: Document changes in CHANGELOG. Refs #292. --- yampa-test/CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index e39431b5..3585ae20 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,3 +1,6 @@ +2024-04-07 Ivan Perez + * Move definitions to separate line (#292). + 2024-02-09 Ivan Perez * Version bump (0.14.7) (#289). From 430b42b4df12212463796e5f0968e05c7b362a77 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 08:19:42 +0000 Subject: [PATCH 3/8] yampa-test: Remove vertical space (KSG Haskell 1.3.0 - 3). Refs #293. No blank lines separate pragmas, the module haddock declaration, and the module declaration. --- yampa-test/tests/Test/FRP/Yampa/Task.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/yampa-test/tests/Test/FRP/Yampa/Task.hs b/yampa-test/tests/Test/FRP/Yampa/Task.hs index 3a1fc58f..48176952 100644 --- a/yampa-test/tests/Test/FRP/Yampa/Task.hs +++ b/yampa-test/tests/Test/FRP/Yampa/Task.hs @@ -4,7 +4,6 @@ -- Copyright : (c) Antony Courtney and Henrik Nilsson, Yale University, 2003-2004 -- Authors : Antony Courtney, Henrik Nilsson -- Very rudimentary testing of Task. - module Test.FRP.Yampa.Task ( tests ) where From 4b250e16426eb4ea51b05bfab59723bdaca9d673 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 08:22:09 +0000 Subject: [PATCH 4/8] yampa-test: Document changes in CHANGELOG. Refs #293. --- yampa-test/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index 3585ae20..04c9faca 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,5 +1,6 @@ 2024-04-07 Ivan Perez * Move definitions to separate line (#292). + * Remove vertical space (#293). 2024-02-09 Ivan Perez * Version bump (0.14.7) (#289). From 6b5acf8e2b5e55a79e75fbf5f706125b2b305ba1 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 08:54:56 +0000 Subject: [PATCH 5/8] yampa: Version bump (0.14.8). Refs #294. --- yampa/Yampa.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yampa/Yampa.cabal b/yampa/Yampa.cabal index 17125c7a..2620c945 100644 --- a/yampa/Yampa.cabal +++ b/yampa/Yampa.cabal @@ -30,7 +30,7 @@ cabal-version: >= 1.10 build-type: Simple name: Yampa -version: 0.14.7 +version: 0.14.8 author: Henrik Nilsson, Antony Courtney maintainer: Ivan Perez (ivan.perez@keera.co.uk) homepage: https://github.com/ivanperez-keera/Yampa/ From 5256e37bca76019da3f6cace66d108d0cc2d1a90 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 08:55:22 +0000 Subject: [PATCH 6/8] yampa-test: Version bump (0.14.8). Refs #294. --- yampa-test/yampa-test.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yampa-test/yampa-test.cabal b/yampa-test/yampa-test.cabal index be20f441..89200301 100644 --- a/yampa-test/yampa-test.cabal +++ b/yampa-test/yampa-test.cabal @@ -31,7 +31,7 @@ cabal-version: >= 1.10 build-type: Simple name: yampa-test -version: 0.14.7 +version: 0.14.8 author: Ivan Perez maintainer: ivan.perez@keera.co.uk homepage: http://github.com/ivanperez-keera/Yampa @@ -84,7 +84,7 @@ library base >= 4 && < 5 , normaldistribution >= 1.1.0.1 && < 1.2 , QuickCheck >= 2.12 && < 2.15 - , Yampa >= 0.14.7 && < 0.15 + , Yampa >= 0.14.8 && < 0.15 default-language: Haskell2010 From cf207c35466493f0872d244a9ab8cf2c689ae73e Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 08:55:55 +0000 Subject: [PATCH 7/8] yampa: Document changes in CHANGELOG. Refs #294. --- yampa/CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yampa/CHANGELOG b/yampa/CHANGELOG index 1e7c4ba3..34f0101e 100644 --- a/yampa/CHANGELOG +++ b/yampa/CHANGELOG @@ -1,3 +1,6 @@ +2024-04-07 Ivan Perez + * Version bump (0.14.8) (#294). + 2024-02-09 Ivan Perez * Version bump (0.14.7) (#289). * Remove postgresql repo before installation in CI script (#284). From 49b35055f7e63a098617dec455f9e8729ce21641 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Mon, 8 Apr 2024 08:56:10 +0000 Subject: [PATCH 8/8] yampa-test: Document changes in CHANGELOG. Refs #294. --- yampa-test/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/yampa-test/CHANGELOG b/yampa-test/CHANGELOG index 04c9faca..8da74a15 100644 --- a/yampa-test/CHANGELOG +++ b/yampa-test/CHANGELOG @@ -1,4 +1,5 @@ 2024-04-07 Ivan Perez + * Version bump (0.14.8) (#294). * Move definitions to separate line (#292). * Remove vertical space (#293).