packages feed

reactive-banana-automation 0.5.0 → 0.5.1

raw patch · 3 files changed

+28/−6 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Reactive.Banana.Automation: instance Data.Semigroup.Semigroup (Reactive.Banana.Automation.Automation sensors actuators ())
- Reactive.Banana.Automation: instance GHC.Classes.Ord t => Data.Semigroup.Semigroup (Reactive.Banana.Automation.Range t)
+ Reactive.Banana.Automation: actuateFutureEvent :: Event (Future a) -> (a -> actuators) -> Automation sensors actuators ()
+ Reactive.Banana.Automation: automationChanges :: Behavior a -> Automation sensors actuators (Event (Future a))
+ Reactive.Banana.Automation: instance GHC.Base.Semigroup (Reactive.Banana.Automation.Automation sensors actuators ())
+ Reactive.Banana.Automation: instance GHC.Classes.Eq Reactive.Banana.Automation.PowerChange
+ Reactive.Banana.Automation: instance GHC.Classes.Ord Reactive.Banana.Automation.PowerChange
+ Reactive.Banana.Automation: instance GHC.Classes.Ord t => GHC.Base.Semigroup (Reactive.Banana.Automation.Range t)

Files

CHANGELOG view
@@ -1,3 +1,10 @@+reactive-banana-automation (0.5.1) upstream; urgency=medium++  * Added Eq and Ord instances for PowerChange.+  * Added automationChanges and actuateFutureEvent.++ -- Joey Hess <id@joeyh.name>  Wed, 22 Aug 2018 18:26:15 -0400+ reactive-banana-automation (0.5.0) upstream; urgency=medium    * Remove onEvent, which allowed arbitrary IO not connected with
Reactive/Banana/Automation.hs view
@@ -34,7 +34,9 @@ 	(=:), 	sensorUnavailable, 	sensedEventBehavior,+	-- * Combinators 	automationStepper,+	automationChanges, 	-- * Time 	Timestamped(..), 	Timestamp(..),@@ -48,6 +50,7 @@ 	-- * Actuators 	PowerChange(..), 	actuateEvent,+	actuateFutureEvent, 	actuateBehavior, 	actuateBehaviorMaybe, 	-- * Ranges@@ -254,6 +257,10 @@ automationStepper :: a -> Event a -> Automation sensors actuators (Behavior a) automationStepper a e = Automation $ lift $ stepper a e +-- | `changes` lifted into `Automation`+automationChanges :: Behavior a -> Automation sensors actuators (Event (Future a))+automationChanges = Automation . lift . changes+ -- | Call when a sensor has sensed a value. -- -- > getFridgeTemperature >>= sensed (fridgeTemperature sensors)@@ -375,7 +382,7 @@ -- | For controlling relays and other things that can have -- their power turned on and off. data PowerChange = PowerOff | PowerOn-	deriving (Show)+	deriving (Show, Eq, Ord)  -- | Makes an Event drive an actuator. actuateEvent :: Event a -> (a -> actuators) -> Automation sensors actuators ()@@ -383,15 +390,23 @@ 	actuators <- snd <$> ask 	lift $ reactimate $ fmap (actuators . getactuator) e +-- | Like `actuateEvent` but with a Future, as produced by+-- `automationChanges`+actuateFutureEvent :: Event (Future a) -> (a -> actuators) -> Automation sensors actuators ()+actuateFutureEvent e getactuator = Automation $ actuateFutureEvent' e getactuator++actuateFutureEvent' :: Event (Future a) -> (a -> actuators) -> ReaderT (sensors, actuators -> IO ()) MomentIO ()+actuateFutureEvent' e getactuator = do+	actuators <- snd <$> ask+	lift $ reactimate' $ fmap (actuators . getactuator) <$> e+ -- | Makes a Behavior drive an actuator. This will happen when the -- Behavior's value changes, but possibly more often as well, depending on -- how the Behavior is constructed. actuateBehavior :: Behavior a -> (a -> actuators) -> Automation sensors actuators () actuateBehavior b getactuator = Automation $ do-	actuators <- snd <$> ask-	c <- lift $ changes b-	lift $ reactimate' $-		fmap (actuators . getactuator) <$> c+	e <- lift $ changes b+	actuateFutureEvent' e getactuator  -- | Variant of `actuateBehavior` that does nothing when a behavior -- is Nothing.
reactive-banana-automation.cabal view
@@ -1,5 +1,5 @@ Name: reactive-banana-automation-Version: 0.5.0+Version: 0.5.1 Cabal-Version: >= 1.8 License: AGPL-3 Maintainer: Joey Hess <id@joeyh.name>