3#if !(MIN_VERSION_base(4,11,0))
4import Data.Semigroup ((<>))
6import Streamly.Prelude (drain, nil, yieldM, (|:))
7import Network.HTTP.Simple
9import qualified Streamly.Prelude as S
11-- | Runs three search engine queries in parallel and prints the search engine
12-- names in the fastest first order.
14-- Does it twice using two different ways.
18 putStrLn "Using parallel stream construction"
19 drain . S.parallely $ google |: bing |: duckduckgo |: nil
21 putStrLn "\nUsing parallel semigroup composition"
22 drain . S.parallely $ yieldM google <> yieldM bing <> yieldM duckduckgo
24 putStrLn "\nUsing parallel applicative zip"
25 drain . S.zipAsyncly $
26 (,,) <$> yieldM google <*> yieldM bing <*> yieldM duckduckgo
29 get :: String -> IO ()
30 get s = httpNoBody (parseRequest_ s) >> print s
32 google, bing, duckduckgo :: IO ()
33 google = get "https://www.google.com/search?q=haskell"
34 bing = get "https://www.bing.com/search?q=haskell"
35 duckduckgo = get "https://www.duckduckgo.com/?q=haskell"
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