-- Parsing xml feed --------------------------------------------------
parseFeed :: RSSFeed -> String -> Maybe (RSSFeed, [RSSItem])
parseFeed fd xml
     | isNothing psfd = Nothing
     | otherwise      = Just (setTitle fd $ getFeedTitle feed, map parseItem $ feedItems feed)
    where psfd        = parseFeedString xml
          (Just feed) = psfd
          setTitle :: RSSFeed -> String -> RSSFeed
          setTitle (RSSFeed r u _ tp tg) t = RSSFeed r u (Just t) tp tg
parseFeed :: RSSFeed -> String -> Maybe (RSSFeed, [RSSItem])
parseFeed fd xml
     | isNothing psfd = Nothing
     | otherwise      = Just (setTitle fd $ getFeedTitle feed, map parseItem $ feedItems feed)
    where psfd        = parseFeedString xml
          (Just feed) = psfd
          setTitle :: RSSFeed -> String -> RSSFeed
          setTitle (RSSFeed r u _ tp tg) t = RSSFeed r u (Just t) tp tg
parseFeed fd xml
     | isNothing psfd = Nothing
     | otherwise      = Just (setTitle fd $ getFeedTitle feed, map parseItem $ feedItems feed)
    where psfd        = parseFeedString xml
          (Just feed) = psfd
          setTitle :: RSSFeed -> String -> RSSFeed
          setTitle (RSSFeed r u _ tp tg) t = RSSFeed r u (Just t) tp tg