X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;ds=sidebyside;f=src%2FTwitter%2FUser.hs;h=2c199c9d3607d0b3187babaf20c5a3ef44669a08;hb=606371fece618f28d3fedf182165ef3a56bf4159;hp=217ee7ddeed4e223b415d5d175947f9ff2c39dad;hpb=94484087fbfe98d6735aa82798a9bf506f97fd19;p=dead%2Fhalcyon.git diff --git a/src/Twitter/User.hs b/src/Twitter/User.hs index 217ee7d..2c199c9 100644 --- a/src/Twitter/User.hs +++ b/src/Twitter/User.hs @@ -1,3 +1,4 @@ +-- | Functions and data for working with Twitter users. module Twitter.User where @@ -5,11 +6,14 @@ import Text.XML.HaXml import Twitter.Xml +-- |Represents a Twitter user, and contains the only attribute thereof +-- that we care about: the screen (user) name. data User = User { screen_name :: String } deriving (Show, Eq) -user_from_content :: Content -> (Maybe User) +-- |Create a 'User' from HaXML 'Content'. +user_from_content :: Content i -> (Maybe User) user_from_content c = if (length names) == 0 then @@ -21,3 +25,9 @@ user_from_content c = where names = user_screen_name c + + +-- |Get the URL for the given screen name's timeline. +screen_name_to_timeline_url :: String -> String +screen_name_to_timeline_url sn = + "http://twitter.com/" ++ sn