Created
September 20, 2009 19:42
-
-
Save deepakjois/189900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment