on master help sign in
Add simple conduit
commite423770f5f1497b86af3bafd4839b35a5fe988f7 authorHarendra Kumar <harendra.kumar@gmail.com> dateTue 5 Sep 2017, 12:01 (9 years ago) parent4756d82
3 files changed+16
asyncly.cabal+1 benchmark/Main.hs+14 stack.yaml+1
asyncly.cabal+1
@@ -77,6 +77,7 @@ benchmark bench
7777 , logict >= 0.6 && < 0.7
7878 , machines >= 0.6 && < 0.7
7979 , mtl >= 2.2 && < 3
80+ , simple-conduit >= 0.6 && < 0.7
8081 , transient >= 0.5 && < 0.6
8182 default-language: Haskell2010
8283
benchmark/Main.hs+14
@@ -10,6 +10,7 @@ import Data.IORef (IORef, newIORef, writeIORef)
1010import System.IO.Unsafe (unsafePerformIO)
1111
1212import qualified Asyncly as A
13+import qualified Conduit.Simple as S
1314import qualified Control.Monad.Logic as LG
1415import qualified Data.Machine as M
1516import qualified Transient.Internals as T
@@ -32,6 +33,7 @@ main = do
3233 , bench "transient-nil" $ nfIO transient_nil
3334 , bench "logict" $ nfIO logict_basic
3435 , bench "list-t" $ nfIO list_t_basic
36+ , bench "simple-conduit" $ nfIO simple_conduit_basic
3537 , bench "machines" $ nfIO machines_basic
3638 ]
3739 ]
@@ -166,6 +168,18 @@ logict_basic = do
166168 assert (Prelude.length xs == 49900) $
167169 return (Prelude.length xs)
168170
171+simple_conduit_basic :: IO Int
172+simple_conduit_basic = do
173+ xs <- S.sourceList [1..100000]
174+ S.$= S.filterC even
175+ S.$= S.mapC ((+1) :: Int -> Int)
176+ S.$= S.dropC 100
177+ S.$= S.mapC ((+1) :: Int -> Int)
178+ S.$= S.filterC (\x -> x `mod` 2 == 0)
179+ S.$$ S.sinkList
180+ assert (Prelude.length xs == 49900) $
181+ return (Prelude.length (xs :: [Int]))
182+
169183machines_basic :: IO Int
170184machines_basic = do
171185 xs <- M.runT $ M.source [1..100000]
stack.yaml+1
@@ -7,6 +7,7 @@ packages:
77 extra-dep: true
88extra-deps:
99 - lockfree-queue-0.2.3.1
10+ - simple-conduit-0.6.0
1011flags: {}
1112extra-package-dbs: []
1213pvp-bounds: both