Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- twitter_user :: MVar (Maybe AuthUser)
- twitter_user = unsafePerformIO (newMVar Nothing)
- setTwitterUser :: IO ()
- setTwitterUser = do
- putStr "User name: "
- u <- getLine
- putStr "User password: "
- p <- getLine
- modifyMVar_ twitter_user (\ _ -> return $ Just (AuthUser u p))
- tweet :: String -> IO ()
- tweet s = do
- r <- readMVar twitter_user
- case r of
- Nothing -> do
- putStrLn "Unable to tweet, no user set - run 'setTwitterUser'" -- "
- return ()
- Just au -> do
- runTM au (update s Nothing)
- return ()
Add Comment
Please, Sign In to add comment