From adb2efc538cc780fbc3282f6be9706191bb057d0 Mon Sep 17 00:00:00 2001 From: Carlos Sosa Date: Wed, 31 Jul 2019 16:32:14 -0700 Subject: Move to specific commands per executable --- app/diff-lists-contacts/Main.hs | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/diff-lists-contacts/Main.hs (limited to 'app/diff-lists-contacts/Main.hs') diff --git a/app/diff-lists-contacts/Main.hs b/app/diff-lists-contacts/Main.hs new file mode 100644 index 0000000..671100c --- /dev/null +++ b/app/diff-lists-contacts/Main.hs @@ -0,0 +1,44 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE FlexibleContexts #-} + +module Main where + +import Web.Twitter.Conduit +import Web.Twitter.Types.Lens +import Control.Lens +import Conduit +import qualified Data.Conduit.List as CL + +tokens :: OAuth +tokens = twitterOAuth + { oauthConsumerKey = "" + , oauthConsumerSecret = "" + } + +credential :: Credential +credential = Credential + [ ("oauth_token", "") + , ("oauth_token_secret", "") + ] + +twInfo :: TWInfo +twInfo = def + { twToken = def { twOAuth = tokens, twCredential = credential } + , twProxy = Nothing + } + +main :: IO () +main = do + mgr <- newManager tlsManagerSettings + putStrLn $ "# your home timeline (up to 200 tweets):" + listMembers <- runConduit $ + sourceWithMaxId twInfo mgr (listMembers (ListNameParam "user/someList")) + .| (CL.isolate 200) + .| (mapC (\user -> do + user ^. userId)) + .| sinkList + + mapM_ (putStrLn . show) listMembers + + + -- cgit v1.3-2-g0d8e