on master help sign in
Add the fastest search engine example
commit0acab071620c1c3cd7540584de60fcc48f651818 authorHarendra Kumar <harendra.kumar@gmail.com> dateThu 7 Sep 2017, 21:04 (9 years ago) parentccc9655
1 file changed+15
examples/fastest.hs+15
examples/fastest.hsnew file+15
@@ -0,0 +1,15 @@
1+#!/usr/bin/env stack
2+-- stack runghc
3+
4+import Asyncly
5+import Network.HTTP.Simple
6+
7+main = do
8+ let urls = [ "https://www.google.com/search?q=haskell"
9+ , "https://www.duckduckgo.com/?q=haskell"
10+ , "https://www.bing.com/search?q=haskell"
11+ ]
12+ xs <- toList $ foldWith (<|>) $ map get urls
13+ mapM_ (putStrLn . show) $ zip [1..] xs
14+
15+ where get s = liftIO $ httpNoBody (parseRequest_ s) >> return s