diff tests/mr.ur @ 1:8de269c09617

Outputting a summary of Marginal Revolution RSS feed
author Adam Chlipala <adam@chlipala.net>
date Tue, 11 Jan 2011 13:17:44 -0500
parents ad85b8813e8a
children ea0ca570c121
line wrap: on
line diff
--- a/tests/mr.ur	Tue Jan 11 10:31:48 2011 -0500
+++ b/tests/mr.ur	Tue Jan 11 13:17:44 2011 -0500
@@ -1,5 +1,17 @@
 fun main () =
-    txt <- Feed.fetch "http://feeds.feedburner.com/marginalrevolution/hCQh";
+    Feed.app (Feed.children
+                  (Feed.tag "item" {1 = "rdf:about"})
+                  (Feed.tag "title" {}, Feed.tag "content:encoded" {}))
+             (fn ({Attrs = {1 = about}, ...},
+                  ({Cdata = title, ...}, {Cdata = content, ...})) =>
+                 debug ("URL: " ^ about);
+                 (case title of
+                      None => return ()
+                    | Some title => debug ("Title: " ^ title));
+                  case content of
+                      None => return ()
+                    | Some content => debug ("Content: " ^ content))
+             "http://feeds.feedburner.com/marginalrevolution/hCQh";
     return <xml>
-      {[txt]}
+      See stdout.
     </xml>