packages feed

auto 0.4.2.2 → 0.4.2.3

raw patch · 9 files changed

+55/−42 lines, 9 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Control.Auto.Process.Random: sealRandom_ :: (RandomGen g, Serialize g, Monad m) => Auto (RandT g m) a b -> g -> Auto m a b
+ Control.Auto.Process.Random: sealRandom_ :: (RandomGen g, Monad m) => Auto (RandT g m) a b -> g -> Auto m a b

Files

CHANGELOG.md view
@@ -1,3 +1,12 @@+0.4.2.3+-------+<https://github.com/mstksg/auto/releases/tag/v0.4.2.3>++*   **Control.Auto.Process.Random**: Removed self-defeating `Seralize`+    constraint on the seed parameter of `sealRandom_`.+*   **Control.Auto.Serialize**: Fixed compiler warning on GHC 7.10 for+    redundant Applicative import.+ 0.4.2.2 ------- <https://github.com/mstksg/auto/releases/tag/v0.4.2.2>
README.md view
@@ -1,6 +1,8 @@ Auto ==== +[![Join the chat at https://gitter.im/mstksg/auto](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mstksg/auto?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)+ ~~~bash $ cabal install auto ~~~@@ -185,8 +187,11 @@  The official support and discussion channel is *#haskell-auto* on freenode. You can also usually find me (the maintainer and developer) as *jle`* on-*#haskell-game* or *#haskell*. Also, contributions to documentation and tests-are welcome! :D+*#haskell-game* or *#haskell*.  There's also a [gitter channel][gitter] if IRC+is not your cup of tea.  Also, contributions to documentation and tests are+welcome! :D++[gitter]: https://gitter.im/mstksg/auto  Why Auto? ---------
auto.cabal view
@@ -1,5 +1,5 @@ name:                auto-version:             0.4.2.2+version:             0.4.2.3 synopsis:            Denotative, locally stateful programming DSL & platform description:         (Up to date documentation is maintained at                      <https://mstksg.github.com/auto>)
src/Control/Auto/Generate.hs view
@@ -289,7 +289,7 @@ -- >>> s' -- 10 ----- Out 'Auto' @a@ behaves exactly like @'sumFrom' 0@, except at each step,+-- Our 'Auto' @a@ behaves exactly like @'sumFrom' 0@, except at each step, -- it also increments the underlying/global state by one.  It is @'sumFrom' -- 0@ with an "attached effect". --
src/Control/Auto/Interval.hs view
@@ -70,7 +70,7 @@ -- -- @ -- type 'Interval' m a b = 'Auto' m a ('Maybe' b)--- type 'Interval'' a b  = 'Auto'' a ('Maybe' b)+-- type 'Interval''  a b = 'Auto''  a ('Maybe' b) -- @ -- -- So, the compiler sees an @'Interval' m a b@ as if it were an @'Auto'@@ -96,21 +96,21 @@ -- -- You might find it useful to "sequence" 'Auto's such that they "switch" -- from one to the other, dynamically.  For example, an 'Auto' that acts--- like @'pure' 0@ for three steps, and then like 'count' for the rest:+-- like @'pure' 100@ for three steps, and then like 'count' for the rest: ----- >>> let a1 = (onFor 3 . pure 0) --> count+-- >>> let a1 = (onFor 3 . pure 100) --> count -- >>> take 8 . streamAuto' a1 $ repeat ()--- [0, 0, 0, 1, 2, 3, 4, 5]+-- [100, 100, 100, 0, 1, 2, 3, 4] -- -- (Recall that @'pure' x@ is the 'Auto' that ignores the input stream and -- gives an output stream of constant @x@s) -- -- Or in reverse, an 'Auto' that behaves like 'count' until the count is--- above 3, then switches to @'pure' 0@+-- above 3, then switches to @'pure' 100@ ----- >>> let a2 = (whenI (<= 3) . count) --> pure 0+-- >>> let a2 = (whenI (<= 3) . count) --> pure 100 -- >>> take 8 . streamAuto' a2 $ repeat ()--- [1, 2, 3, 0, 0, 0, 0, 0]+-- [0, 1, 2, 3, 100, 100, 100, 100] -- -- That's just a small example using one switching combinator, '-->'.  But -- hopefully it demonstrates that one powerful motivation behind@@ -121,7 +121,8 @@ -- -- The following 'Interval' will be "off" and suppress all of its input -- (from 'count') /until/ the blip stream produced by @'inB' 3@ emits--- something, then it'll allow 'count' to pass.+-- something, then it'll allow 'count' to pass, beginning with the step+-- during which the blip was emmitted. -- -- >>> let a3 = after . (count &&& inB 3) -- >>> let a3 = proc () -> do@@ -129,7 +130,7 @@ --             blp <- inB 3 -< () --             after -< (c, blp) -- >>> take 5 . streamAuto' a3 $ repeat ()--- [Nothing, Nothing, Just 3, Just 4, Just 4]+-- [Nothing, Nothing, Just 2, Just 3, Just 4] -- -- Intervals are also used for things that want their 'Auto's to "signal" -- when they are "off".  'Interval' is the universal language for, "you can@@ -218,7 +219,7 @@ -- a               :: 'Auto' m a b -- i               :: 'Interval' m b c -- i . 'toOn' . a    :: 'Interval' m a c--- 'fmap' 'Just' a :: 'Interval' m a b+-- 'fmap' 'Just' a     :: 'Interval' m a b -- i . 'fmap' 'Just' a :: 'Interval' m a c -- @ --@@ -239,11 +240,11 @@ -- @ --     i1            :: 'Interval' m a b --     i2            :: 'Interval' m b c---     i2 `'compI'` i1 :: 'Interval' m a b c+--     i2 ``compI`` i1 :: 'Interval' m a b c --     'bindI' i2 . i1 :: 'Interval' m a b c -- @ ----- >>> let a1        = whenI (< 5) `compI` offFor 2+-- >>> let a1 = whenI (< 5) `compI` offFor 2 -- >>> streamAuto' a1 [1..6] -- [Nothing, Nothing, Just 3, Just 4, Nothing, Nothing] --@@ -273,7 +274,7 @@ -- output can be "on" or "off" (using 'Just' and 'Nothing') for contiguous -- chunks of time. ----- "Just" a type alias for @'Auto' m a ('Maybe' b)@.  If you ended up here+-- \"Just\" a type alias for @'Auto' m a ('Maybe' b)@.  If you ended up here -- with a link...no worries!  If you see @'Interval' m a b@, just think -- @'Auto' m a ('Maybe' b)@ for type inference/type checking purposes. --@@ -341,12 +342,12 @@ onFor = mkState f . Just . max 0   where     f x (Just i) | i > 0 = (Just x , Just (i - 1))-    f _ _        = (Nothing, Nothing)+    f _ _                = (Nothing, Nothing)  -- | For @'offFor' n@, the first @n@ items in the output stream are always -- "off", suppressing all input; for the rest, the output stream is always -- "on", outputting exactly the value of the corresponding input.-offFor :: Int     -- ^ amount of steps to be "off" for.+offFor :: Int     -- ^ amount of steps to be "off" for        -> Interval m a a offFor = mkState f . Just . max 0   where@@ -389,9 +390,8 @@ -- | Like 'whenI', but only allows values to pass whenever the input does -- not satisfy the predicate.  Blocks whenever the predicate is true. ----- >>> let a = unlessI (\x -> x < 2 &&& x > 4)+-- >>> let a = unlessI (\x -> x < 2 || x > 4) -- >>> steamAuto' a [1..6]--- >>> res -- [Nothing, Just 2, Just 3, Just 4, Nothing, Nothing] -- unlessI :: (a -> Bool)   -- ^ interval predicate@@ -409,8 +409,7 @@ -- -- >>> let a = after . (count &&& inB 3) -- >>> take 6 . streamAuto' a $ repeat ()--- >>> res--- [Nothing, Nothing, Just 3, Just 4, Just 5, Just 6]+-- [Nothing, Nothing, Just 2, Just 3, Just 4, Just 5] -- -- ('count' is the 'Auto' that ignores its input and outputs the current -- step count at every step, and @'inB' 3@ is the 'Auto' generating@@ -436,8 +435,7 @@ -- -- >>> let a = before . (count &&& inB 3) -- >>> take 5 . streamAuto' a $ repeat ()--- >>> res--- [Just 1, Just 2, Nothing, Nothing, Nothing]+-- [Just 0, Just 1, Nothing, Nothing, Nothing] -- -- ('count' is the 'Auto' that ignores its input and outputs the current -- step count at every step, and @'inB' 3@ is the 'Auto' generating@@ -463,9 +461,9 @@ -- the first stream toggles this "on"; an emission from the second stream -- toggles this "off". ----- >>> let a        = between . (count &&& (inB 3 &&& inB 5))+-- >>> let a = between . (count &&& (inB 3 &&& inB 5)) -- >>> take 7 . streamAuto' a $ repeat ()--- [Nothing, Nothing, Just 3, Just 4, Nothing, Nothing, Nothing]+-- [Nothing, Nothing, Just 2, Just 3, Nothing, Nothing, Nothing] between :: Interval m (a, (Blip b, Blip c)) a between = mkState f False   where@@ -506,8 +504,7 @@ -- number of steps. -- -- >>> let a = holdFor 2 . inB 3--- >>> streamAuto' 7 a [1..7]--- >>> res+-- >>> streamAuto' a [1..7] -- [Nothing, Nothing, Just 3, Just 3, Nothing, Nothing, Nothing] -- holdFor :: Serialize a@@ -553,7 +550,6 @@ -- -- >>> let a = (onFor 2 . pure "hello") <|?> (onFor 4 . pure "world") -- >>> take 5 . streamAuto' a $ repeat ()--- >>> res -- [Just "hello", Just "hello", Just "world", Just "world", Nothing] -- -- You can drop the parentheses, because of precedence; the above could@@ -639,7 +635,7 @@ -- @'Auto' m ('Maybe' a) ('Maybe' b)@ (or, @'Interval' m ('Maybe' a) b@, -- transforming /intervals/ of @a@s into /intervals/ of @b@. ----- It does this by running the 'Auuto' as normal when the input is "on",+-- It does this by running the 'Auto' as normal when the input is "on", -- and freezing it/being "off" when the input is /off/. -- -- >>> let a1 = during (sumFrom 0) . onFor 2 . pure 1
src/Control/Auto/Process/Random.hs view
@@ -505,7 +505,7 @@ -- | The non-serializing/non-resuming version of 'sealRandom_'.  The random -- seed is not re-loaded/resumed, so every time you resume, the stream of -- available randomness begins afresh.-sealRandom_ :: (RandomGen g, Serialize g, Monad m)+sealRandom_ :: (RandomGen g, Monad m)             => Auto (RandT g m) a b         -- ^ 'Auto' to seal             -> g                            -- ^ initial seed             -> Auto m a b
src/Control/Auto/Run.hs view
@@ -371,7 +371,7 @@ --            -> Auto' a b -- execAutoN' n a0 = snd . stepAutoN' n a0 --- | Lifts an @'Auto' m a b@ to one that runs "through a 'Traversable'@,+-- | Lifts an @'Auto' m a b@ to one that runs "through" a 'Traversable', -- @'Auto' m (t a) (t b)@.  It does this by running itself sequentially -- over every element "in" the 'Traversable' at every input. --
src/Control/Auto/Serialize.hs view
@@ -67,14 +67,15 @@   , loadFromB   ) where +import Control.Applicative import Control.Auto.Blip.Internal-import Control.Monad.IO.Class-import Control.Monad+import Control.Auto.Core import Control.Exception-import Control.Applicative+import Control.Monad+import Control.Monad.IO.Class+import Prelude import System.IO.Error-import Control.Auto.Core-import qualified Data.ByteString as B+import qualified Data.ByteString  as B  -- | Give a 'FilePath' and an 'Auto', and 'readAuto' will attempt to resume -- the saved state of the 'Auto' from disk, reading from the given
tutorial/tutorial.md view
@@ -1028,10 +1028,11 @@ a different aspect of the library, so you can see how all of these ideas work together. -Help is always available on the *#haskell-auto* channel on freenode IRC; you-can also email me at <justin@jle.im>, or find me on twitter as-[mstk][twitter].  There is no mailing list or message board yet, but for now,-feel free to abuse the [github issue tracker][issues].+Help is always available on the *#haskell-auto* channel on freenode IRC, and+there's also a [gitter channel][] if IRC is not your thing; you can also email+me at <justin@jle.im>, or find me on twitter as [mstk][twitter].  There is no+mailing list or message board yet, but for now, feel free to abuse the [github+issue tracker][issues].  Now go forth and make locally stateful, denotative, declarative programs! @@ -1039,6 +1040,7 @@ [auto-examples]: https://github.com/mstksg/auto-examples [blog]: http://blog.jle.im [docs]: https://mstksg.github.io/auto/+[gitter channel]: https://gitter.im/mstksg/auto [hackage]: http://hackage.haskell.org/package/auto [issues]: https://github.com/mstksg/auto/issues [mkAutoM]: http://mstksg.github.io/auto/Control-Auto-Core.html#v:mkAutoM