diff src/ur/feed.ur @ 5:2717458d8951

Splitting fetching and traversal into separate functions
author Adam Chlipala <adam@chlipala.net>
date Thu, 13 Jan 2011 10:02:37 -0500
parents af95d9d73eb5
children e0bae488825c
line wrap: on
line diff
--- a/src/ur/feed.ur	Tue Jan 11 18:04:15 2011 -0500
+++ b/src/ur/feed.ur	Thu Jan 13 10:02:37 2011 -0500
@@ -177,7 +177,11 @@
                                    None => None
                                  | Some (cdata, _) => Some ((pdata, cdata), True)}
 
-fun app [internal ::: Type] [data ::: Type] (p : pattern internal data) (f : data -> transaction {}) (url : string) : transaction {} =
+type document = string
+
+val fetch = FeedFfi.fetch
+
+fun app [internal ::: Type] [data ::: Type] (p : pattern internal data) (f : data -> transaction {}) (doc : document) : transaction {} =
     let
         fun recur xml state =
             case String.seek xml #"<" of
@@ -305,6 +309,5 @@
                                      recur xml (if cont then state else p.Initial)
                         end
     in
-        xml <- FeedFfi.fetch url;
-        recur xml p.Initial
+        recur doc p.Initial
     end