関数型プログラミング言語Haskell Part7
■ このスレッドは過去ログ倉庫に格納されています
018355
2007/04/02(月) 12:48:42runXを1回済むようにできないか考えてるところ。
(実行にはHTTP, HXT, hslogger, FilePath, MissingHあたりが必要。)
import Data.List (sortBy)
import System.Locale (defaultTimeLocale)
import System.Time (CalendarTime)
import System.Time.ParseDate (parseCalendarTime)
import Text.XML.HXT.Arrow
data RssItem = RssItem { title :: String,
link :: String,
description :: String,
pubDate :: CalendarTime }
deriving (Show)
instance Eq RssItem where
a == b = (pubDate a) == (pubDate b)
instance Ord RssItem where
compare a b = compare (pubDate a) (pubDate b)
main :: IO ()
main = getRssItems "http://www.microsoft.com/japan/msdn/rss.xml"
>>=
writeHtml "result.html" . take 10 . sortBy (\a b -> compare b a)
■ このスレッドは過去ログ倉庫に格納されています