varying 0.7.1.0 → 0.7.1.1
raw patch · 2 files changed
+21/−6 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Varying.Core: VarT :: a -> m (b, VarT m a b) -> VarT m a b
+ Control.Varying.Core: VarT :: (a -> m (b, VarT m a b)) -> VarT m a b
- Control.Varying.Core: arr :: Arrow a => b -> c -> a b c
+ Control.Varying.Core: arr :: Arrow a => (b -> c) -> a b c
- Control.Varying.Core: stepMany :: (Monad m) => VarT m a b -> [a] -> a -> m (b, VarT m a b)
+ Control.Varying.Core: stepMany :: Monad m => VarT m a b -> [a] -> a -> m (b, VarT m a b)
- Control.Varying.Spline: SplineT :: a -> m (Either c (b, SplineT a b m c)) -> SplineT a b m c
+ Control.Varying.Spline: SplineT :: (a -> m (Either c (b, SplineT a b m c))) -> SplineT a b m c
Files
- src/Control/Varying/Core.hs +20/−5
- varying.cabal +1/−1
src/Control/Varying/Core.hs view
@@ -64,10 +64,12 @@ -- | A continuously varying value, with effects. -- It's a kind of <https://en.wikipedia.org/wiki/Mealy_machine Mealy machine> -- (an automaton).-newtype VarT m a b = VarT { runVarT :: a -> m (b, VarT m a b) }- -- ^ Run a @VarT@ computation with an input value of- -- type 'a', yielding a step - a value of type 'b'- -- and a new computation for yielding the next step.+newtype VarT m a b+ = VarT+ { runVarT :: a -> m (b, VarT m a b) }+ -- ^ Run a @VarT@ computation with an input value of+ -- type 'a', yielding a step - a value of type 'b'+ -- and a new computation for yielding the next step. -- | A var parameterized with Identity that takes input of type @a@@@ -175,8 +177,21 @@ (c, _) <- runVarT v b return (c, app) +-- | Inputs can depend on outputs as long as no time-travel is required.+--+-- This isn't the best example but it does make a good test case:+-- >>> :{+-- let+-- testVar :: VarT IO Double (Maybe Double)+-- testVar = proc val -> do+-- rec _ <- returnA -< 0.5+-- returnA -< Just 5.0+-- in+-- testVarOver testVar [5.0]+-- >>> :}+-- Just 5.0 instance MonadFix m => ArrowLoop (VarT m) where- loop vmbdcd = VarT $ \b -> fmap fst $ mfix $ \(_, d) -> do+ loop vmbdcd = VarT $ \b -> fmap fst $ mfix $ \(~(_, d)) -> do ((c1, d1), vmbdcd1) <- runVarT vmbdcd (b, d) return ((c1, loop vmbdcd1), d1)
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.1.0+version: 0.7.1.1 -- A short (one-line) description of the package. synopsis: FRP through value streams and monadic splines.