wires 0.2.0 → 0.2.1
raw patch · 8 files changed
+48/−30 lines, 8 filesdep ~semigroupoids
Dependency ranges changed: semigroupoids
Files
- CHANGELOG.md +22/−6
- Control/Wire/Controller.hs +1/−1
- Control/Wire/Core.hs +6/−6
- Control/Wire/Internal.hs +7/−3
- Control/Wire/Trans.hs +2/−2
- Control/Wire/Varying.hs +3/−3
- README.md +5/−7
- wires.cabal +2/−2
CHANGELOG.md view
@@ -1,19 +1,35 @@+# 0.2.1++ * Fix: bumped version bounds++ * Fix: more strictness fixes++ * Fix: `README.md` formatting for Hackage++ * Add: Semigroup and generalised Monoid instances for `Event`++## Contributors++ * [tsahyt](https://github.com/tsahyt)+ # 0.2.0 - * **Breaking change**: Safer API for `manage` and `manage'`.+ * **Breaking change**: Safer API for `manage` and `manage'` - * Fix: Wire strictness. Strict value recursion like the following+ * Fix: wire strictness; strict value recursion like the following works now: rec x <- scan x0 -< x `seq` ev - * Change: Tighter version bounds.+ * Change: tighter version bounds - * Add: `splitE`, `unalignE`, `unlessE`.+ * Add: event functions `splitE`, `unalignE`, `unlessE` - * Add: `hoistW`.+ * Add: wire transforms `asksW`, `askW`, `hoistW`, `runReaderW` - * Add: `asksW`, `askW`, `runReaderW`.+## Contributors++ * [Kosyrev Serge](mailto:_deepfire@feelingofgreen.ru) # 0.1.0
Control/Wire/Controller.hs view
@@ -1,5 +1,5 @@ -- |--- Copyright: (c) 2016 Ertugrul Söylemez+-- Copyright: (c) 2017 Ertugrul Söylemez -- License: BSD3 -- Maintainer: Ertugrul Söylemez <esz@posteo.de> -- Stability: experimental
Control/Wire/Core.hs view
@@ -1,5 +1,5 @@ -- |--- Copyright: (c) 2016 Ertugrul Söylemez+-- Copyright: (c) 2017 Ertugrul Söylemez -- License: BSD3 -- Maintainer: Ertugrul Söylemez <esz@posteo.de> -- Stability: experimental@@ -66,7 +66,7 @@ where go w' = Wire $ \x ->- (\(y, w) -> (y, go w))+ (\ ~(y, w) -> (y, go w)) <$> trans x (stepWire w' (f x)) @@ -99,7 +99,7 @@ => f (Wire m a b) -> Wire m (a, Event (Switch f m a b)) (f b) manage ws' =- Wire $ \(x, mf) ->+ Wire $ \ ~(x, mf) -> (\ys -> (fst <$> ys, manage (event id (\(Switch f) -> f id) mf (snd <$> ys)))) <$> traverse (`stepWire` x) ws'@@ -114,7 +114,7 @@ => f (Wire m a b) -> Wire m (a, Event (Switch f m a b)) (f b) manage' ws' =- Wire $ \(x, mf) ->+ Wire $ \ ~(x, mf) -> (\ys -> (fst <$> ys, manage' (snd <$> ys))) <$> traverse (`stepWire` x) (event id (\(Switch f) -> f id) mf ws')@@ -143,7 +143,7 @@ switch :: (Functor m) => Wire m a (b, Event (Wire m a b)) -> Wire m a b switch w' = Wire $ \x ->- (\((y, mw), w) -> (y, event (switch w) id mw))+ (\ ~(~(y, mw), w) -> (y, event (switch w) id mw)) <$> stepWire w' x @@ -153,7 +153,7 @@ switch' :: (Monad m) => Wire m a (b, Event (Wire m a b)) -> Wire m a b switch' w' = Wire $ \x -> do- ((y, mw), w) <- stepWire w' x+ ~(~(y, mw), w) <- stepWire w' x case mw of NotNow -> pure (y, switch' w) Now nw -> stepWire nw x
Control/Wire/Internal.hs view
@@ -26,6 +26,7 @@ import Data.Functor.Extend import Data.Functor.Plus import Data.Profunctor+import Data.Semigroup import Data.These import Prelude hiding ((.), id) @@ -64,8 +65,8 @@ duplicated = event NotNow (Now . Now) extended f = event NotNow (Now . f . Now) -instance (Monoid a) => Monoid (Event a) where- mappend = alignWith (mergeThese mappend)+instance (Semigroup a) => Monoid (Event a) where+ mappend = (<>) mempty = nil instance (NFData a) => NFData (Event a) where@@ -75,7 +76,10 @@ instance Plus Event where zero = nil +instance (Semigroup a) => Semigroup (Event a) where+ (<>) = alignWith (mergeThese (<>)) + -- | 'Wire' is a language for defining reactive systems. It is similar -- to the underlying monad @m@, but runs continuously. @@ -188,7 +192,7 @@ delayW :: (Functor m) => b -> Wire m a b -> Wire m a b delayW y' w' = Wire $- fmap (\(y, w) -> (y', delayW y w)) .+ fmap (\ ~(y, w) -> (y', delayW y w)) . stepWire w'
Control/Wire/Trans.hs view
@@ -1,5 +1,5 @@ -- |--- Copyright: (c) 2016 Ertugrul Söylemez+-- Copyright: (c) 2017 Ertugrul Söylemez -- License: BSD3 -- Maintainer: Ertugrul Söylemez <esz@posteo.de> @@ -33,4 +33,4 @@ -- | Embed the given 'ReaderT'-transformed monad. runReaderW :: (Functor m) => Wire (ReaderT e m) a b -> Wire m (e, a) b-runReaderW = hoistW snd (\(env, _) c -> runReaderT c env)+runReaderW = hoistW snd (\x c -> runReaderT c (fst x))
Control/Wire/Varying.hs view
@@ -1,5 +1,5 @@ -- |--- Copyright: (c) 2016 Ertugrul Söylemez+-- Copyright: (c) 2017 Ertugrul Söylemez -- License: BSD3 -- Maintainer: Ertugrul Söylemez <esz@posteo.de> -- Stability: experimental@@ -79,7 +79,7 @@ fromString = pure . fromString instance Monad Varying where- Varying cx x >>= f =+ ~(Varying cx x) >>= f = let Varying cy y = f x in Varying (cx || cy) y @@ -98,7 +98,7 @@ animateV :: (Applicative m) => (a -> m b) -> Wire m (Varying a) (Varying b) animateV f =- Wire $ \(Varying cx x) -> do+ Wire $ \ ~(Varying cx x) -> do (\y -> (Varying cx y, go y)) <$> f x
README.md view
@@ -27,13 +27,11 @@ time-varying values map to actual things on the screen or in the network. The module structure reflects that distinction: -Module | Purpose---------------------------|------------------------------------------------`Control.Wire` | Application language (basically core + utils).-`Control.Wire.Controller` | Controller language.-`Control.Wire.Core` | Core application language.-`Control.Wire.Internal` | You should never need this module.-`Control.Wire.Utils` | Extra application utilities.+ * `Control.Wire`: Application language (basically core + utils)+ * `Control.Wire.Controller`: Controller language+ * `Control.Wire.Core`: Core application language+ * `Control.Wire.Internal`: You should never need this module+ * `Control.Wire.Utils`: Extra application utilities Modules not listed here are highly experimental and should not be used.
wires.cabal view
@@ -1,5 +1,5 @@ name: wires-version: 0.2.0+version: 0.2.1 category: Control, FRP synopsis: Functional reactive programming library @@ -33,7 +33,7 @@ deepseq == 1.4.*, mtl >= 2.0 && < 2.3, profunctors >= 5.0 && < 5.3,- semigroupoids >= 5.0 && < 5.2,+ semigroupoids >= 5.0 && < 5.3, these == 0.7.* default-language: Haskell2010 ghc-options: -W