auto 0.4.2.3 → 0.4.3.0
raw patch · 4 files changed
+33/−5 lines, 4 filesdep ~containersdep ~deepseqPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers, deepseq
API changes (from Hackage documentation)
+ Control.Auto.Blip: splitEitherB :: (a -> Either b c) -> Auto m (Blip a) (Blip b, Blip c)
Files
- CHANGELOG.md +9/−0
- auto.cabal +3/−3
- src/Control/Auto/Blip.hs +17/−1
- src/Control/Auto/Core.hs +4/−1
CHANGELOG.md view
@@ -1,3 +1,12 @@+0.4.2.4+-------+<https://github.com/mstksg/auto/releases/tag/v0.4.2.4>++* **Control.Auto.Blip**: New blip stream splitter `onEitherB`, which splits+ an incoming blip stream into two output streams based on whether the+ emitted items resolve to `Left` or `Right` when applied to the splitting+ function.+ 0.4.2.3 ------- <https://github.com/mstksg/auto/releases/tag/v0.4.2.3>
auto.cabal view
@@ -1,5 +1,5 @@ name: auto-version: 0.4.2.3+version: 0.4.3.0 synopsis: Denotative, locally stateful programming DSL & platform description: (Up to date documentation is maintained at <https://mstksg.github.com/auto>)@@ -90,8 +90,8 @@ , base-orphans >= 0.3.1 , bytestring >= 0.10.4.0 , cereal >= 0.4.1.1- , containers >= 0.5.5.1- , deepseq >= 1.3.0.2+ , containers >= 0.5+ , deepseq >= 1.3.0 , profunctors >= 4.3 , random >= 1.1 , semigroups >= 0.16
src/Control/Auto/Blip.hs view
@@ -64,12 +64,13 @@ , lagBlips_ , filterB , splitB+ , mapMaybeB+ , splitEitherB , collectB , collectB_ , collectBs , collectBs_ , joinB- , mapMaybeB , takeB , takeWhileB , dropB@@ -548,6 +549,21 @@ Blip x' | p x' -> (x, NoBlip) | otherwise -> (NoBlip, x) _ -> (NoBlip, NoBlip)++-- | "Splits" a blip stream based on a predicate returning an 'Either'.+-- All 'Left' results go to the first output stream, and all 'Right'+-- results go to the second.+--+-- On an 'a -> Either () b', is roughly analogous to 'mapMaybeB'. On an 'a+-- -> Either () ()', is roughly analogous to 'filterB' or 'splitB'.+splitEitherB :: (a -> Either b c)+ -> Auto m (Blip a) (Blip b, Blip c)+splitEitherB f = mkFunc $ \x -> case x of+ Blip x' -> case f x' of+ Left y -> (Blip y, NoBlip)+ Right y -> (NoBlip, Blip y)+ _ -> (NoBlip, NoBlip)+ -- | "Collapses" a blip stream of blip streams into single blip stream. -- that emits whenever the inner-nested stream emits.
src/Control/Auto/Core.hs view
@@ -111,8 +111,11 @@ import Data.Serialize import Data.String import Data.Traversable-import Data.Typeable import Prelude hiding ((.), id, sequence)++#if MIN_VERSION_base(4,7,0)+import Data.Typeable+#endif -- | The 'Auto' type. For this library, an 'Auto' semantically