[Sorting channel items by pubDate Manuel M T Chakravarty **20060508015921] { hunk ./Config.hs 50 -date = "06 May 2006" +date = "07 May 2006" hunk ./LambdaFeed.hs 74 --- * Channel formatting. --- hunk ./LambdaFeed.hs 81 --- * Synthetic channels: Channels that don't have an item directory, but --- instead instructions on how to synthesise them from other channels by --- eg, merging and filtering. +-- * More elaborate channel formatting and/or synthetic channels: Channels +-- that don't have an item directory, but instead instructions on how to +-- synthesise them from other channels by eg, merging and filtering. hunk ./LambdaFeed.hs 118 +import Data.List ( + sortBy) hunk ./LambdaFeed.hs 255 -formatFeed config feed = +formatFeed config (Feed chans) = + liftM Feed $ mapM (formatChan config) chans + +formatChan :: Config -> Channel [Item] -> IO (Channel [Item]) +formatChan config chan = hunk ./LambdaFeed.hs 261 - sayV config $ "Formatting feed (NOTHING DONE YET)" - return feed + sayV config $ "Sorting channel `" ++ titleChan chan ++ "'" + return $ chan {itemsChan = sortBy newer (itemsChan chan)} + where + item1 `newer` item2 = + case pubDateItem item1 `compare` pubDateItem item2 of + LT -> GT + EQ -> EQ + GT -> LT hunk ./lambdaFeed.cabal 4 ---Versdate: "06 May 2006" +--Versdate: "07 May 2006" }