packages feed

hw-conduit 0.1.0.0 → 0.2.0.0

raw patch · 4 files changed

+35/−16 lines, 4 filesdep −hw-bitsdep −resourcetdep ~basePVP ok

version bump matches the API change (PVP)

Dependencies removed: hw-bits, resourcet

Dependency ranges changed: base

API changes (from Hackage documentation)

+ HaskellWorks.Data.Conduit.Combinator: inJust :: Monad m => Conduit a m c -> Conduit (Maybe a) m (Maybe c)

Files

− app/Main.hs
@@ -1,4 +0,0 @@-module Main where--main :: IO ()-main = putStrLn "Hello world"
hw-conduit.cabal view
@@ -1,5 +1,5 @@ name:                   hw-conduit-version:                0.1.0.0+version:                0.2.0.0 synopsis:               Conduits for tokenizing streams. description:            Please see README.md homepage:               http://github.com/haskell-works/hw-conduit#readme@@ -13,25 +13,15 @@ extra-source-files:     README.md cabal-version:          >= 1.22 -executable hw-conduit-example-  hs-source-dirs:       app-  main-is:              Main.hs-  ghc-options:          -threaded -rtsopts -with-rtsopts=-N -O2 -Wall -msse4.2-  build-depends:        base                          >= 4          && < 5-                      , criterion-                      , hw-conduit-  default-language:     Haskell2010- library   hs-source-dirs:       src   exposed-modules:      HaskellWorks.Data.Conduit.ByteString+                      , HaskellWorks.Data.Conduit.Combinator                       , HaskellWorks.Data.Conduit.List   build-depends:        base                          >= 4          && < 5                       , array                       , bytestring                       , conduit-                      , hw-bits                       >= 0.4.0.0-                      , resourcet                       , word8    default-language:     Haskell2010@@ -42,8 +32,10 @@   hs-source-dirs:       test   main-is:              Spec.hs   other-modules:        HaskellWorks.Data.Conduit.ByteStringSpec+                      , HaskellWorks.Data.Conduit.CombinatorSpec   build-depends:        base                          >= 4          && < 5                       , bytestring+                      , conduit                       , hspec                       , hw-conduit   ghc-options:          -threaded -rtsopts -with-rtsopts=-N -Wall
+ src/HaskellWorks/Data/Conduit/Combinator.hs view
@@ -0,0 +1,10 @@+module HaskellWorks.Data.Conduit.Combinator where++import           Data.Conduit+import           Data.Conduit.List as L+import           Data.Maybe++inJust :: Monad m => Conduit a m c -> Conduit (Maybe a) m (Maybe c)+inJust c = getZipConduit+      $   ZipConduit (L.filter isNothing  .|      L.map (const Nothing))+      <*  ZipConduit (L.concat            .| c .| L.map Just           )
+ test/HaskellWorks/Data/Conduit/CombinatorSpec.hs view
@@ -0,0 +1,21 @@+module HaskellWorks.Data.Conduit.CombinatorSpec (spec) where++import           Data.Conduit+import           Data.Conduit.List                    as L+import           Data.Maybe+import           HaskellWorks.Data.Conduit.Combinator++import           Test.Hspec++{-# ANN module ("HLint: ignore Redundant do" :: String) #-}++spec :: Spec+spec = describe "HaskellWorks.Data.Conduit.CombinatorSpec" $ do+  describe "inJust" $ do+    it "should map when Just and propagate Nothing" $ do+      let input = [Just 1, Just 2, Nothing, Nothing, Just 4, Nothing] :: [Maybe Int]+      let results = runConduitPure $+                L.sourceList input+            .|  inJust (L.map (+1))+            .|  L.consume+      results `shouldBe` [Just 2, Just 3, Nothing, Nothing, Just 5, Nothing]