pipes-category 0.2.0.0 → 0.2.0.1
raw patch · 2 files changed
+14/−3 lines, 2 filesdep ~pipes-categoryPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: pipes-category
API changes (from Hackage documentation)
Files
- pipes-category.cabal +3/−3
- src/Pipes/Shaft.hs +11/−0
pipes-category.cabal view
@@ -1,7 +1,7 @@ name: pipes-category-version: 0.2.0.0+version: 0.2.0.1 synopsis: Allows instances for Category, Arrow and ArrowChoice for Pipes.-description: Please see README.md+description: Allows instances for Category, Arrow and ArrowChoice for Pipes. homepage: https://github.com/louispan/pipes-category#readme license: BSD3 license-file: LICENSE@@ -30,7 +30,7 @@ main-is: Spec.hs build-depends: base >= 4.7 && < 5 , pipes >= 4 && < 5- , pipes-category >= 0.1.0.0+ , pipes-category , transformers >= 0.4 && < 0.6 , hspec >= 2 && < 3 ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
src/Pipes/Shaft.hs view
@@ -23,10 +23,14 @@ instance Monad m => Category (Shaft r m) where id = Shaft P.cat+ {-# INLINABLE id #-}+ (Shaft a) . (Shaft b) = Shaft (b P.>-> a)+ {-# INLINABLE (.) #-} instance Monad m => Arrow (Shaft r m) where arr f = Shaft (PE.arr f)+ {-# INLINABLE arr #-} -- | Send the first component of the input through the argument arrow, and copy the rest unchanged to the output. -- first :: Monad m => Shaft r m b c -> Shaft r m (b, d) (c, d)@@ -54,6 +58,7 @@ a <- P.await put $ f a P.yield a+ {-# INLINABLE first #-} -- | A mirror image of 'first'. -- second :: Monad m => Shaft r m b c -> Shaft r m (d, b) (d, c)@@ -62,6 +67,7 @@ P.>-> runShaft (first $ Shaft bc) -- P.>-> (_Unwrapping Shaft %~ first $ bc) P.>-> PP.map swap+ {-# INLINABLE second #-} -- Note: The following works, but may not actually be more optimal than default (***) -- So maybe it's better to reduce the amount of code to maintain.@@ -97,5 +103,10 @@ instance Monad m => ArrowChoice (Shaft r m) where left (Shaft a) = Shaft (PE.left a)+ {-# INLINABLE left #-}+ right (Shaft a) = Shaft (PE.right a)+ {-# INLINABLE right #-}+ (Shaft a) +++ (Shaft b) = Shaft (a PE.+++ b)+ {-# INLINABLE (+++) #-}