packages feed

pipes-misc 0.4.0.1 → 0.5.0.0

raw patch · 4 files changed

+47/−43 lines, 4 filesdep ~Decimaldep ~clockdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: Decimal, clock, hspec, lens, mmorph, mtl, pipes, pipes-category, pipes-concurrency, semigroups, stm, transformers

API changes (from Hackage documentation)

- Pipes.Misc.State.Lazy: retrieve :: MonadState s m => Getter s b -> Pipe a (b, a) m r
- Pipes.Misc.State.Lazy: retrieve' :: MonadState s m => Getter s b -> Pipe () b m r
- Pipes.Misc.State.Strict: retrieve :: MonadState s m => Getter s b -> Pipe a (b, a) m r
- Pipes.Misc.State.Strict: retrieve' :: MonadState s m => Getter s b -> Pipe () b m r
+ Pipes.Misc.State.Lazy: restore :: MonadState s m => Getter s b -> Pipe a (b, a) m r
+ Pipes.Misc.State.Lazy: restore' :: MonadState s m => Getter s b -> Pipe () b m r
+ Pipes.Misc.State.Strict: restore :: MonadState s m => Getter s b -> Pipe a (b, a) m r
+ Pipes.Misc.State.Strict: restore' :: MonadState s m => Getter s b -> Pipe () b m r

Files

pipes-misc.cabal view
@@ -1,5 +1,5 @@ name:                pipes-misc-version:             0.4.0.1+version:             0.5.0.0 synopsis:            Miscellaneous utilities for pipes, required by glazier-tutorial description:         Please see README.md homepage:            https://github.com/louispan/pipes-misc#readme@@ -11,7 +11,7 @@ category:            Control, Pipes build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC == 7.10.3, GHC == 8.0.1+tested-with:         GHC == 8.0.1  library   hs-source-dirs:      src@@ -22,17 +22,17 @@                        Pipes.Misc.Time                        Pipes.Misc.Util   build-depends:       base >= 4.7 && < 5-                     , clock >= 0.7 && < 1-                     , lens >= 4 && < 5-                     , Decimal >= 0.4 && < 1-                     , mmorph >= 1 && < 2-                     , mtl >= 2 && < 3-                     , pipes >= 4 && < 5-                     , pipes-category >= 0.3 && < 0.4-                     , pipes-concurrency >= 2 && < 3-                     , semigroups >= 0.18 && < 1-                     , stm >= 2.4 && < 3-                     , transformers >= 0.4 && < 0.6+                     , clock >= 0.7+                     , lens >= 4+                     , Decimal >= 0.4+                     , mmorph >= 1+                     , mtl >= 2+                     , pipes >= 4+                     , pipes-category >= 0.3+                     , pipes-concurrency >= 2+                     , semigroups >= 0.18+                     , stm >= 2.4+                     , transformers >= 0.4   ghc-options:         -Wall   default-language:    Haskell2010 @@ -41,14 +41,14 @@   hs-source-dirs:      test   main-is:             Spec.hs   build-depends:       base >= 4.7 && < 5-                     , lens >=4 &&< 5-                     , mmorph >= 1 && < 2-                     , pipes >= 4 && < 5-                     , pipes-concurrency >= 2 && < 3+                     , lens >=4+                     , mmorph >= 1+                     , pipes >= 4+                     , pipes-concurrency >= 2                      , pipes-misc-                     , stm >= 2.4 && < 3-                     , transformers >= 0.4 && < 0.6-                     , hspec >= 2 && < 3+                     , stm >= 2.4+                     , transformers >= 0.4+                     , hspec >= 2   ghc-options:         -Wall -threaded -rtsopts -with-rtsopts=-N   default-language:    Haskell2010 
src/Pipes/Misc/State/Lazy.hs view
@@ -16,15 +16,15 @@   P.yield a  -- | Yields a view into the stored value.-retrieve :: MonadState s m => Getter s b -> P.Pipe a (b, a) m r-retrieve v = forever $ do+restore :: MonadState s m => Getter s b -> P.Pipe a (b, a) m r+restore v = forever $ do   a <- P.await   s <- get   P.yield (view v s, a)  -- | Yields a view into the stored value-retrieve' :: MonadState s m => Getter s b -> P.Pipe () b m r-retrieve' v = forever $ do+restore' :: MonadState s m => Getter s b -> P.Pipe () b m r+restore' v = forever $ do   P.await   s <- get   P.yield (view v s)
src/Pipes/Misc/State/Strict.hs view
@@ -15,15 +15,15 @@   P.yield a  -- | Yields a view into the stored value.-retrieve :: MonadState s m => Getter s b -> P.Pipe a (b, a) m r-retrieve v = forever $ do+restore :: MonadState s m => Getter s b -> P.Pipe a (b, a) m r+restore v = forever $ do   a <- P.await   s <- get   P.yield (view v s, a)  -- | Yields a view into the stored value-retrieve' :: MonadState s m => Getter s b -> P.Pipe () b m r-retrieve' v = forever $ do+restore' :: MonadState s m => Getter s b -> P.Pipe () b m r+restore' v = forever $ do   P.await   s <- get   P.yield (view v s)
test/Spec.hs view
@@ -1,11 +1,12 @@ module Main where -import Control.Concurrent.STM+-- import Control.Concurrent+-- import Control.Concurrent.STM import Control.Lens-import Control.Monad.Morph+-- import Control.Monad.Morph import Data.Foldable import qualified Pipes as P-import qualified Pipes.Concurrent as PC+-- import qualified Pipes.Concurrent as PC import qualified Pipes.Misc as PM import qualified Pipes.Prelude as PP import Test.Hspec@@ -18,18 +19,21 @@  main :: IO () main = do-  hspec $ do-      describe "Misc" $ do-          it "Buffered" $ do-              let xs = PP.toList (sig1 P.>-> PM.buffer 2 [])-              xs `shouldBe` (pure $ head data1) : ((\(a, b) -> [a, b]) <$> zip (tail data1) data1)+    hspec $ do+        describe "Misc" $ do+            it "Buffered" $ do+                let xs = PP.toList (sig1 P.>-> PM.buffer 2 [])+                xs `shouldBe` (pure $ head data1) : ((\(a, b) -> [a, b]) <$> zip (tail data1) data1) -          it "Locally +10 to second" $ do-              let xs = PP.toList-                       (sig1+            it "Locally +10 to second" $ do+                let xs = PP.toList+                        (sig1                         P.>-> PP.map (\a -> (a, a))                         P.>-> PM.locally (view _2) (set _2) (PP.map (+ 10)))-              xs `shouldBe` zip data1 ((+ 10) <$> data1)-          it "Filtering STM Producer blocks" $ do-              sig <- PM.mkProducerSTM (PC.bounded 1) sig1-              PP.toListM (hoist atomically (sig P.>-> PP.filter even)) `shouldThrow` anyException+                xs `shouldBe` zip data1 ((+ 10) <$> data1)++            -- -- hspec 2.5 doesn't work well with blocked threads, so comment this test out+            -- -- jcristovao/enclosed-exceptions#12+            -- it "Filtering STM Producer blocks" $ do+            --     sig <- PM.mkProducerSTM (PC.bounded 1) sig1+            --     PP.toListM (hoist atomically (sig P.>-> PP.filter even)) `shouldThrow` anyException