reactive-banana 0.8.0.4 → 0.8.1.0
raw patch · 4 files changed
+23/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Reactive.Banana.Switch: instance Applicative (AnyMoment Identity)
+ Reactive.Banana.Switch: instance Functor (AnyMoment Event)
+ Reactive.Banana.Switch: instance Functor (AnyMoment Identity)
Files
- CHANGELOG.md +6/−0
- reactive-banana.cabal +1/−1
- src/Reactive/Banana/Switch.hs +12/−0
- src/Reactive/Banana/Test/Plumbing.hs +4/−1
CHANGELOG.md view
@@ -1,6 +1,12 @@ Changelog for the `reactive-banana` package ------------------------------------------- +**version 0.8.1.0**++* Module `Reactive.Banana.Switch` now adheres to the "Functor Applicative Monad Proposal" proposal][amp-proposal].++ [amp-proposal]: https://wiki.haskell.org/Functor-Applicative-Monad_Proposal+ **version 0.8.0.4** * Just a reupload. The previous archive was broken.
reactive-banana.cabal view
@@ -1,5 +1,5 @@ Name: reactive-banana-Version: 0.8.0.4+Version: 0.8.1.0 Synopsis: Library for functional reactive programming (FRP). Description: Reactive-banana is a library for Functional Reactive Programming (FRP).
src/Reactive/Banana/Switch.hs view
@@ -44,6 +44,15 @@ -- | Value present at any/every moment in time. newtype AnyMoment f a = AnyMoment { now :: forall t. Moment t (f t a) } +-- | Instance relying on the monad instance.+instance Functor (AnyMoment Identity) where+ fmap = liftM++-- | Instance relying on the monad instance.+instance Applicative (AnyMoment Identity) where+ pure = return+ (<*>) = ap+ instance Monad (AnyMoment Identity) where return x = AnyMoment $ return (Identity x) (AnyMoment m) >>= g = AnyMoment $ m >>= \(Identity x) -> now (g x)@@ -54,6 +63,9 @@ instance Applicative (AnyMoment Behavior) where pure x = AnyMoment $ return $ pure x (AnyMoment f) <*> (AnyMoment x) = AnyMoment $ liftM2 (<*>) f x++instance Functor (AnyMoment Event) where+ fmap f (AnyMoment x) = AnyMoment (fmap (fmap f) x) anyMoment :: (forall t. Moment t (f t a)) -> AnyMoment f a anyMoment = AnyMoment
src/Reactive/Banana/Test/Plumbing.hs view
@@ -7,7 +7,7 @@ module Reactive.Banana.Test.Plumbing where import Control.Applicative-import Control.Monad (liftM)+import Control.Monad (liftM, ap) import Control.Monad.Fix import qualified Reactive.Banana.Model as X@@ -60,6 +60,9 @@ instance Applicative Behavior where pure = pureB; (<*>) = applyB instance Functor Moment where fmap = liftM+instance Applicative Moment where+ pure = return+ (<*>) = ap instance Monad Moment where return a = M (return a) (return a) (M x y) >>= g = M (x >>= fstM . g) (y >>= sndM . g)