]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/commitdiff
Don't download full stories if we aren't going to use them.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 13 Jul 2012 00:29:44 +0000 (20:29 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 13 Jul 2012 00:29:44 +0000 (20:29 -0400)
src/LWN/Page.hs

index d4aeb3006cab8c331c76219a723d1a20baf6f623..3dccf466fea98f49a8ee42dcf44a2cdebe66a42c 100644 (file)
@@ -134,7 +134,7 @@ insert_full_stories story_map =
     article_xml :: (ArrowXml a) => a XmlTree XmlTree
     article_xml =
       lookup_func
-      $<
+      $< -- From HXT's Control.Arrow.ArrowList
       (this /> full_story_link >>> getAttrValue "href")
                    
 replace_remote_img_srcs :: (ArrowXml a) => ImageMap -> a XmlTree XmlTree
@@ -192,11 +192,11 @@ download_full_stories cfg xml = do
 
 parse :: Cfg -> IOSArrow XmlTree XmlTree -> IO (Maybe Page)
 parse cfg xml = do
-  story_map <- download_full_stories cfg xml
-  let fs_xml = if (full_stories cfg) then
-                 xml >>> insert_full_stories story_map
-               else
-                 xml
+  fs_xml <- if (full_stories cfg) then do
+             story_map <- download_full_stories cfg xml
+             return $ xml >>> insert_full_stories story_map
+           else do
+             return xml
 
   let clean_xml = fs_xml >>> preprocess
   image_map <- download_images clean_xml