auto 0.4.2.1 → 0.4.2.2
raw patch · 8 files changed
+41/−61 lines, 8 filesdep +base-orphansdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: base-orphans
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +11/−0
- auto.cabal +2/−1
- src/Control/Auto/Blip/Internal.hs +2/−1
- src/Control/Auto/Collection.hs +1/−4
- src/Control/Auto/Core.hs +5/−7
- src/Control/Auto/Effects.hs +0/−24
- src/Control/Auto/Process/Random.hs +1/−6
- src/Control/Auto/Switch.hs +19/−18
CHANGELOG.md view
@@ -1,6 +1,17 @@+0.4.2.2+-------+<https://github.com/mstksg/auto/releases/tag/v0.4.2.2>++* Using the *base-orphans* library for a more sane compatibility layer than+ the previous method.+* Many documentation fixes including haddock reconfigurations on specific+ modules.+ 0.4.2.1 ------- <https://github.com/mstksg/auto/releases/tag/v0.4.2.1>++**DEPRECATED:** Please use `0.4.2.2`! * Added support for building with GHC 7.6.x.
auto.cabal view
@@ -1,5 +1,5 @@ name: auto-version: 0.4.2.1+version: 0.4.2.2 synopsis: Denotative, locally stateful programming DSL & platform description: (Up to date documentation is maintained at <https://mstksg.github.com/auto>)@@ -87,6 +87,7 @@ -- other-extensions: build-depends: base >= 4.6 && < 5 , MonadRandom >= 0.3.0.1+ , base-orphans >= 0.3.1 , bytestring >= 0.10.4.0 , cereal >= 0.4.1.1 , containers >= 0.5.5.1
src/Control/Auto/Blip/Internal.hs view
@@ -1,6 +1,7 @@-{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-}+{-# OPTIONS_HADDOCK not-home #-} -- | -- Module : Control.Auto.Blip.Internal
src/Control/Auto/Collection.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} @@ -93,6 +92,7 @@ import Data.Map.Strict (Map) import Data.Maybe import Data.Monoid+import Data.Orphans () import Data.Profunctor import Data.Serialize import Data.Traversable@@ -100,9 +100,6 @@ import qualified Data.IntMap.Strict as IM import qualified Data.Map.Strict as M -#if !MIN_VERSION_base(4,7,0)-import Compat()-#endif -- | Give a list of @'Auto' m a b@ and get back an @'Auto' m [a] [b]@ --- -- take a list of @a@'s and feed them to each of the 'Auto's, and collects
src/Control/Auto/Core.hs view
@@ -1,8 +1,9 @@-{-# LANGUAGE TupleSections #-}-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE TupleSections #-}+{-# OPTIONS_HADDOCK not-home #-} -- | -- Module : Control.Auto.Core@@ -104,6 +105,7 @@ import Control.Monad.Fix import Data.ByteString hiding (empty) import Data.Functor.Identity+import Data.Orphans () import Data.Profunctor import Data.Semigroup import Data.Serialize@@ -111,10 +113,6 @@ import Data.Traversable import Data.Typeable import Prelude hiding ((.), id, sequence)--#if !MIN_VERSION_base(4,7,0)-import Compat()-#endif -- | The 'Auto' type. For this library, an 'Auto' semantically
src/Control/Auto/Effects.hs view
@@ -762,30 +762,6 @@ ((y, a'), s1) <- runStateT (stepAuto a x) s0 return (y, sealState_ a' s1) -sealStateM :: Monad m- => Auto (StateT s m) a b -- ^ 'Auto' run over 'State'- -> m s -- ^ action to draw new @s@ at every step- -> (s -> m ()) -- ^ action to "update" the state at every step- -> Auto m a b-sealStateM a0 gt pt = go a0- where- go a = mkAutoM (go <$> resumeAuto a)- (saveAuto a)- $ \x -> do- s <- gt- ((y, a'), s') <- runStateT (stepAuto a x) s- pt s'- return (y, go a')--sealStateMVar :: MonadIO m- => Auto (StateT s m) a b -- ^ 'Auto' run over 'State'- -> MVar s -- ^ 'MVar' containing an @s@ for every step- -> Auto m a b-sealStateMVar a0 mv = sealStateM a0- (liftIO $ takeMVar mv)- (liftIO . putMVar mv )--- TODO: Masking?- -- | "Unrolls" the underlying 'StateT' of an 'Auto' into an 'Auto' that -- takes in an input state every turn (in addition to the normal input) and -- outputs, along with the original result, the modified state.
src/Control/Auto/Process/Random.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- -- | -- Module : Control.Auto.Process.Random -- Description : Entropy generationg 'Auto's.@@ -135,13 +133,10 @@ import Control.Monad (guard) import Control.Monad.Random import Data.Bits+import Data.Orphans () import Data.Serialize import Data.Tuple import Prelude hiding (id, (.), concat, concatMap, sum)--#if !MIN_VERSION_base(4,7,0)-import Compat()-#endif -- | Given a seed-consuming generating function of form @g -> (b, g)@
src/Control/Auto/Switch.hs view
@@ -63,16 +63,16 @@ -- | "This, then that". Behave like the first 'Interval' (and run its -- effects) as long as it is "on" (outputting 'Just'). As soon as it turns--- off (is 'Nothing), it'll "switch over" and begin behaving like the+-- off (is 'Nothing'), it'll "switch over" and begin behaving like the -- second 'Auto' forever, running the effects of the second 'Auto', too. -- Works well if the 'Auto's follow interval semantics from -- "Control.Auto.Interval". ----- >>> let a1 = whileI (<= 4) --> pure 0+-- >>> let a1 = whenI (<= 4) --> pure 0 -- >>> streamAuto' a1 [1..10] -- [1, 2, 3, 4, 0, 0, 0, 0, 0, 0] ----- ('whileI' only lets items satisfying the predicate pass through as "on",+-- ('whenI' only lets items satisfying the predicate pass through as "on", -- and is "off" otherwise; 'pure' is the 'Auto' that always produces the -- same output) --@@ -95,7 +95,7 @@ -- Note that recursive bindings work just fine, so: -- -- >>> let a3 = onFor 2 . pure "hello"--- --> onFor 2 . pure "goodbye"+-- --> onFor 2 . pure "world" -- --> a3 -- >>> let (res3, _) = stepAutoN' 8 a3 () -- >>> res3@@ -131,7 +131,7 @@ a1 --> a2 = fmap fromJust (a1 -?> fmap Just a2) -- | A variation of '-->', where the right hand side can also be an--- interval/'Maybe'. The entire result is, then, a 'Maybe'. Probably less+-- 'Interval' / 'Maybe'. The entire result is, then, a 'Maybe'. Probably less -- useful than '-->' in most situations. (-?>) :: Monad m => Interval m a b -- ^ initial behavior@@ -204,8 +204,8 @@ -- contained 'Auto'. -- -- However, as soon as the blip stream of the contained 'Auto' emits a new--- 'Auto'...it immediately /replaces/ the contained 'Auto' with the /new/--- one. And the whole thing starts all over again.+-- 'Auto', it /replaces/ the contained 'Auto' with the /new/ one (just after+-- emitting the "normal value"), and the whole thing starts all over again. -- -- @'switchFrom_' a0@ will "start" with @a0@ already in the box. --@@ -249,10 +249,11 @@ -- @ -- -- >>> streamAuto' (switchFrom_ a2) [101..112]--- [ 101, 203, 306 -- first 'sumFrom', on first three items--- , 104, 209, 315 -- second 'sumFrom', on second three items--- , 107, 215, 324 -- third 'sumFrom', on third three items (107, 108, 109)--- , 110, 221, 333] -- final 'sumFrom', on fourht three items (110, 111, 112)+-- [ 101, 203, 306 -- first 'sumFrom', on first three items [101, 102, 103]+-- , 104, 209, 315 -- second 'sumFrom', on second three items [104, 105, 106]+-- , 107, 215, 324 -- third 'sumFrom', on third three items [107, 108, 109]+-- , 110, 221, 333 -- final 'sumFrom', on fourth three items [110, 111, 112]+-- ] -- -- Note that this combinator is inherently unserializable, so you are going -- to lose all serialization capabilities if you use this. So sad, I know!@@ -335,7 +336,7 @@ -- new 'Auto'. -- -- Here is the equivalent of the two examples from 'switchFrom_',--- implemented with 'switchFromF'; see the documentatino for 'switchFrom_'+-- implemented with 'switchFromF'; see the documentation for 'switchFrom_' -- for a description of what they are to do. -- -- @@@ -349,7 +350,7 @@ -- a1' = sumFrom 0 &&& (tagBlips 100 . inB 4) -- @ ----- >>> streamAuto' (switchFrom_ pure a1) [1..10]+-- >>> streamAuto' (switchFromF (\x -> (x,) <$> never) a1) [1..10] -- [1,3,6,10,100,100,100,100,100,100] -- -- @@@ -357,17 +358,17 @@ -- a2 = proc x -> do -- sums <- sumFrom 0 -< x -- switchBlip <- inB 3 -< ()--- id -< (c, switchBlip)+-- id -< (sums, switchBlip) -- -- -- alternatively -- a2' = sumFrom 0 &&& (tagBlips () . inB 3) -- @ -- -- >>> streamAuto' (switchFromF (const a2) a2) [101..112]--- [ 101, 203, 306 -- first 'sumFrom', on first three items--- , 104, 209, 315 -- second 'sumFrom', on second three items--- , 107, 215, 324 -- third 'sumFrom', on third three items (107, 108, 109)--- , 110, 221, 333] -- final 'sumFrom', on fourht three items (110, 111, 112)+-- [ 101, 203, 306 -- first 'sumFrom', on first three items [101, 102, 103]+-- , 104, 209, 315 -- second 'sumFrom', on second three items [104, 105, 106]+-- , 107, 215, 324 -- third 'sumFrom', on third three items [107, 108, 109]+-- , 110, 221, 333] -- final 'sumFrom', on fourth three items [110, 111, 112] -- -- Or, if you're only ever going to use @a2@ in switching form: --