1{-# LANGUAGE UndecidableInstances #-}
3-- Module : Streamly.Internal.Data.Stream.Concurrent
4-- Copyright : (c) 2017 Composewell Technologies
5-- License : BSD-3-Clause
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
10-- To run examples in this module:
12-- >>> import qualified Streamly.Prelude as Stream
14module Streamly.Internal.Data.Stream.Zip.Concurrent
20import Streamly.Internal.Data.Stream (Stream)
21import Streamly.Internal.Data.Stream.Concurrent (MonadAsync, zipWith)
23import qualified Streamly.Internal.Data.Stream as Stream (repeat)
24import Prelude hiding (map, repeat, zipWith)
27-- >>> import qualified Streamly.Internal.Data.Stream as Stream
28-- >>> import qualified Streamly.Data.Fold as Fold
31newtype ZipConcurrent m a = ZipConcurrent {getZipConcurrent :: Stream m a}
34-- | An IO stream whose applicative instance zips streams concurrently.
36-- >>> s = ZipConcurrent $ Stream.fromList [1, 2, 3]
37-- >>> x = (,,) <$> s <*> s <*> s
38-- >>> Stream.fold Fold.toList (getZipConcurrent x)
39-- [(1,1,1),(2,2,2),(3,3,3)]
43instance MonadAsync m => Applicative (ZipConcurrent m) where
44 pure = ZipConcurrent . Stream.repeat
47 ZipConcurrent m1 <*> ZipConcurrent m2 = ZipConcurrent $ zipWith id m1 m2
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list