Yampa 0.10.5.1 → 0.10.6
raw patch · 37 files changed
+98/−13 lines, 37 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ FRP.Yampa: iterFrom :: (a -> a -> DTime -> b -> b) -> b -> SF a b
+ FRP.Yampa.Integration: iterFrom :: (a -> a -> DTime -> b -> b) -> b -> SF a b
+ FRP.Yampa.Switches: parC :: SF a b -> SF [a] [b]
- FRP.Yampa: reactimate :: IO a -> (Bool -> IO (DTime, Maybe a)) -> (Bool -> b -> IO Bool) -> SF a b -> IO ()
+ FRP.Yampa: reactimate :: Monad m => m a -> (Bool -> m (DTime, Maybe a)) -> (Bool -> b -> m Bool) -> SF a b -> m ()
- FRP.Yampa.Simulation: reactimate :: IO a -> (Bool -> IO (DTime, Maybe a)) -> (Bool -> b -> IO Bool) -> SF a b -> IO ()
+ FRP.Yampa.Simulation: reactimate :: Monad m => m a -> (Bool -> m (DTime, Maybe a)) -> (Bool -> b -> m Bool) -> SF a b -> m ()
Files
- CHANGELOG +7/−0
- Yampa.cabal +1/−1
- src/FRP/Yampa.hs +2/−1
- src/FRP/Yampa/Integration.hs +2/−3
- src/FRP/Yampa/InternalCore.hs +19/−0
- src/FRP/Yampa/Simulation.hs +6/−5
- src/FRP/Yampa/Switches.hs +30/−1
- src/FRP/Yampa/Utilities.hs +2/−2
- tests/AFRPTests.hs +1/−0
- tests/AFRPTestsAccum.hs +1/−0
- tests/AFRPTestsArr.hs +1/−0
- tests/AFRPTestsBasicSF.hs +1/−0
- tests/AFRPTestsCOC.hs +1/−0
- tests/AFRPTestsCommon.hs +1/−0
- tests/AFRPTestsComp.hs +1/−0
- tests/AFRPTestsDelay.hs +1/−0
- tests/AFRPTestsDer.hs +1/−0
- tests/AFRPTestsEmbed.hs +1/−0
- tests/AFRPTestsEvSrc.hs +1/−0
- tests/AFRPTestsFirstSecond.hs +1/−0
- tests/AFRPTestsKSwitch.hs +1/−0
- tests/AFRPTestsLaws.hs +1/−0
- tests/AFRPTestsLoop.hs +1/−0
- tests/AFRPTestsLoopIntegral.hs +1/−0
- tests/AFRPTestsLoopLaws.hs +1/−0
- tests/AFRPTestsLoopPre.hs +1/−0
- tests/AFRPTestsPSwitch.hs +1/−0
- tests/AFRPTestsPre.hs +1/−0
- tests/AFRPTestsRPSwitch.hs +1/−0
- tests/AFRPTestsRSwitch.hs +1/−0
- tests/AFRPTestsReact.hs +1/−0
- tests/AFRPTestsSscan.hs +1/−0
- tests/AFRPTestsSwitch.hs +1/−0
- tests/AFRPTestsTask.hs +1/−0
- tests/AFRPTestsUtils.hs +1/−0
- tests/AFRPTestsWFG.hs +1/−0
- tests/testAFRPMain.hs +1/−0
CHANGELOG view
@@ -1,3 +1,10 @@+2017-05-05 Ivan Perez <ivan.perez@keera.co.uk>+ * Yampa.cabal: Version bump (0.10.6).+ * tests/: do not warn if they contain tabs.+ * src/: Includes combinators to deal with collections,+ to iterate over time (for custom/discrete integration),+ implements ArrowChoice.+ 2017-04-26 Ivan Perez <ivan.perez@keera.co.uk> * .travis.yml: Instruct TravisCI upload package to hackage. * Yampa.cabal: Version bump (0.10.5.1).
Yampa.cabal view
@@ -1,5 +1,5 @@ name: Yampa-version: 0.10.5.1+version: 0.10.6 cabal-version: >= 1.8 license: BSD3 license-file: LICENSE
src/FRP/Yampa.hs view
@@ -348,6 +348,7 @@ -- -> col (SF b c) -- -> SF (a, Event (col (SF b c) -> col (SF b c))) -- (col c)+ -- -- * Discrete to continuous-time signal functions -- ** Wave-form generation@@ -391,7 +392,7 @@ -- Temporarily hidden, but will eventually be made public.- -- iterFrom, -- :: (a -> a -> DTime -> b -> b) -> b -> SF a b+ iterFrom, -- :: (a -> a -> DTime -> b -> b) -> b -> SF a b -- * Noise (random signal) sources and stochastic event sources noise, -- :: noise :: (RandomGen g, Random b) =>
src/FRP/Yampa/Integration.hs view
@@ -20,11 +20,10 @@ count, -- :: Integral b => SF (Event a) (Event b) -- * Differentiation- derivative -- :: VectorSpace a s => SF a a -- Crude!-+ derivative, -- :: VectorSpace a s => SF a a -- Crude! -- Temporarily hidden, but will eventually be made public.- -- iterFrom, -- :: (a -> a -> DTime -> b -> b) -> b -> SF a b+ iterFrom -- :: (a -> a -> DTime -> b -> b) -> b -> SF a b ) where
src/FRP/Yampa/InternalCore.hs view
@@ -497,6 +497,25 @@ id = SF $ \x -> (sfId,x) #endif +instance ArrowChoice SF where+ left sf = SF $ \a ->+ -- NOTE: there might be a problem with choice here.+ -- Do the delta times accumulate for the unused branch?+ -- Recommendation by Olivier Charles: take a look+ -- at Settable Signals paper, it discusses which+ -- option would be best.+ case a of+ Left x -> let (sf', b') = sfTF sf x+ in (futureArrowLeft sf', Left b')+ Right x -> let sf' = SF' $ \_ -> sfTF sf+ in (futureArrowLeft sf', Right x)+ where futureArrowLeft fSF = SF' $ \dt a ->+ case a of+ Left x -> let (sf', b') = sfTF' fSF dt x+ in (futureArrowLeft sf', Left b')+ Right x -> (futureArrowLeft fSF, Right x)+ + instance Arrow SF where arr = arrPrim first = firstPrim
src/FRP/Yampa/Simulation.hs view
@@ -103,11 +103,12 @@ -- at different time steps. If you need to control the main -- loop yourself for these or other reasons, use 'reactInit' and 'react'. -reactimate :: IO a -- ^ IO initialization action- -> (Bool -> IO (DTime, Maybe a)) -- ^ IO input sensing action- -> (Bool -> b -> IO Bool) -- ^ IO actuaction (output processing) action- -> SF a b -- ^ Signal function- -> IO ()+reactimate :: Monad m+ => m a -- ^ Initialization action+ -> (Bool -> m (DTime, Maybe a)) -- ^ Input sensing action+ -> (Bool -> b -> m Bool) -- ^ Actuaction (output processing) action+ -> SF a b -- ^ Signal function+ -> m () reactimate init sense actuate (SF {sfTF = tf0}) = do a0 <- init
src/FRP/Yampa/Switches.hs view
@@ -62,6 +62,9 @@ rpSwitchZ, -- [SF a b] -> SF ([a], Event ([SF a b]->[SF a b])) [b] drpSwitchZ, -- [SF a b] -> SF ([a], Event ([SF a b]->[SF a b])) [b] + -- Application of an SF to a collections+ parC, -- SF a b -> SF [a] [b]+ ) where import Control.Arrow@@ -581,7 +584,7 @@ (parAux rf sfs, cs0) --- Internal definition. Also used in parallel swithers.+-- Internal definition. Also used in parallel switchers. parAux :: Functor col => (forall sf . (a -> col sf -> col (b, sf))) -> col (SF' b c)@@ -806,6 +809,32 @@ freezeCol :: Functor col => col (SF' a b) -> DTime -> col (SF a b) freezeCol sfs dt = fmap (`freeze` dt) sfs++-- Apply an SF to every element of a list.+parC :: SF a b -> SF [a] [b]+parC sf = SF $ \as -> let os = map (sfTF sf) as+ bs = map snd os+ sfs = map fst os+ in (parCAux sfs, bs)++-- Internal definition. Also used in parallel switchers.+parCAux :: [SF' a b] -> SF' [a] [b]+parCAux sfs = SF' tf+ where+ tf dt as =+ let os = map (\(a,sf) -> sfTF' sf dt a) $ safeZip "parC" as sfs+ bs = map snd os+ sfcs = map fst os+ in+ (listSeq sfcs `seq` parCAux sfcs, listSeq bs)++listSeq :: [a] -> [a]+listSeq x = x `seq` (listSeq' x)++listSeq' :: [a] -> [a]+listSeq' [] = []+listSeq' rs@(a:as) = a `seq` listSeq' as `seq` rs+ -- Vim modeline -- vim:set tabstop=8 expandtab:
src/FRP/Yampa/Utilities.hs view
@@ -43,14 +43,14 @@ import FRP.Yampa.EventS import FRP.Yampa.Hybrid --- * Window sampling+-- | Window sampling+-- -- First argument is the window length wl, second is the sampling interval t. -- The output list should contain (min (truncate (T/t) wl)) samples, where -- T is the time the signal function has been running. This requires some -- care in case of sparse sampling. In case of sparse sampling, the -- current input value is assumed to have been present at all points where -- sampling was missed.- sampleWindow :: Int -> Time -> SF a (Event [a]) sampleWindow wl q = identity &&& afterEachCat (repeat (q, ()))
tests/AFRPTests.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTests.hs,v 1.27 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsAccum.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsAccum.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsArr.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsArr.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsBasicSF.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsBasicSF.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsCOC.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsCOC.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsCommon.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsCommon.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsComp.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsComp.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsDelay.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsDelay.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsDer.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsDer.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsEmbed.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsEmbed.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsEvSrc.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsEvSrc.hs,v 1.3 2003/12/19 15:32:22 henrik Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsFirstSecond.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsFirstSecond.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsKSwitch.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsKSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsLaws.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsLaws.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsLoop.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsLoop.hs,v 1.6 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsLoopIntegral.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsLoopIntegral.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsLoopLaws.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsLoopLaws.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsLoopPre.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsLoopPre.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsPSwitch.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsPSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsPre.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsDelay.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsRPSwitch.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsRPSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsRSwitch.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsRSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsReact.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsReact.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsSscan.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id$ ****************************************************************************** * A F R P *
tests/AFRPTestsSwitch.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsTask.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsTask.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsUtils.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsUtils.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/AFRPTestsWFG.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: AFRPTestsWFG.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *
tests/testAFRPMain.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-tabs #-} {- $Id: testAFRPMain.hs,v 1.9 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P *