packages feed

bearriver 0.10.4.2 → 0.10.4.3

raw patch · 2 files changed

+39/−7 lines, 2 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ FRP.BearRiver: (>--) :: Monad m => a -> SF m a b -> SF m a b
+ FRP.BearRiver: never :: Monad m => SF m a (Event b)
+ FRP.BearRiver: now :: Monad m => b -> SF m a (Event b)
+ FRP.BearRiver: once :: Monad m => SF m (Event a) (Event a)
+ FRP.BearRiver: replaceOnce :: Monad m => a -> SF m a a
+ FRP.BearRiver: takeEvents :: Monad m => Int -> SF m (Event a) (Event a)
- FRP.BearRiver: dup :: t -> (t, t)
+ FRP.BearRiver: dup :: () => b -> (b, b)
- FRP.BearRiver: eventToMaybe :: Event a -> Maybe a
+ FRP.BearRiver: eventToMaybe :: () => Event a -> Maybe a
- FRP.BearRiver: fromEvent :: Event t -> t
+ FRP.BearRiver: fromEvent :: () => Event p -> p
- FRP.BearRiver: isEvent :: Event t -> Bool
+ FRP.BearRiver: isEvent :: () => Event a -> Bool
- FRP.BearRiver: maybeToEvent :: Maybe a -> Event a
+ FRP.BearRiver: maybeToEvent :: () => Maybe a -> Event a
- FRP.Yampa.AffineSpace: class (Floating a, VectorSpace v a) => AffineSpace p v a | p -> v, v -> a where p .-^ v = p .+^ (negateVector v) distance p1 p2 = norm (p1 .-. p2)
+ FRP.Yampa.AffineSpace: class (Floating a, VectorSpace v a) => AffineSpace p v a | p -> v, v -> a
- FRP.Yampa.VectorSpace: class (Eq a, Floating a) => VectorSpace v a | v -> a where v ^/ a = (1 / a) *^ v negateVector v = (- 1) *^ v v1 ^-^ v2 = v1 ^+^ negateVector v2 norm v = sqrt (v `dot` v) normalize v = if nv /= 0 then v ^/ nv else error "normalize: zero vector" where nv = norm v
+ FRP.Yampa.VectorSpace: class (Eq a, Floating a) => VectorSpace v a | v -> a

Files

bearriver.cabal view
@@ -1,5 +1,5 @@ name:                bearriver-version:             0.10.4.2+version:             0.10.4.3 synopsis:            A replacement of Yampa based on Monadic Stream Functions. description:         A Yampa replacement built using Dunai. homepage:            keera.co.uk@@ -7,10 +7,10 @@ license-file:        LICENSE author:              Ivan Perez and Manuel Bärenz maintainer:          ivan.perez@keera.co.uk--- copyright:           +-- copyright: category:            FRP build-type:          Simple--- extra-source-files:  +-- extra-source-files: cabal-version:       >=1.10  library@@ -23,7 +23,7 @@                        FRP.Yampa.AffineSpace,                        FRP.BearRiver -  build-depends:       base >=4.7 && <5, transformers >=0.3, mtl, dunai, MonadRandom+  build-depends:       base >=4.6 && <5, transformers >=0.3, mtl, dunai, MonadRandom   hs-source-dirs:      src/   default-language:    Haskell2010 
src/FRP/BearRiver.hs view
@@ -146,6 +146,24 @@ loopPre :: Monad m => c -> SF m (a, c) (b, c) -> SF m a b loopPre = feedback +-- | Event source that never occurs.+never :: Monad m => SF m a (Event b)+never = constant NoEvent++-- | Event source with a single occurrence at time 0. The value of the event+-- is given by the function argument.+now :: Monad m => b -> SF m a (Event b)+now b0 = Event b0 --> never++-- | Suppress all but the first event.+once :: Monad m => SF m (Event a) (Event a)+once = takeEvents 1++-- | Suppress all but the first n events.+takeEvents :: Monad m => Int -> SF m (Event a) (Event a)+takeEvents n | n <= 0 = never+takeEvents n = dSwitch (arr dup) (const (NoEvent >-- takeEvents (n - 1)))+ after :: Monad m       => Time -- ^ The time /q/ after which the event should be produced       -> b    -- ^ Value to produce at that time@@ -173,10 +191,24 @@   timeDelta :: Monad m => SF m a DTime   timeDelta = arrM_ ask +-- | Initialization operator (cf. Lustre/Lucid Synchrone).+--+-- The output at time zero is the first argument, and from+-- that point on it behaves like the signal function passed as+-- second argument. (-->) :: Monad m => b -> SF m a b -> SF m a b-b0 --> sf = MSF $ \a -> do-  (_, ct) <- unMSF sf a-  return (b0, ct)+b0 --> sf = sf >>> replaceOnce b0++-- | Input initialization operator.+--+-- The input at time zero is the first argument, and from+-- that point on it behaves like the signal function passed as+-- second argument.+(>--) :: Monad m => a -> SF m a b -> SF m a b+a0 >-- sf = replaceOnce a0 >>> sf++replaceOnce :: Monad m => a -> SF m a a+replaceOnce a = dSwitch (arr $ const (a, Event ())) (const $ arr id)  accumHoldBy :: Monad m => (b -> a -> b) -> b -> SF m (Event a) b accumHoldBy f b = feedback b $ arr $ \(a, b') ->